diff --git a/src/doc/common/conf.py b/src/doc/common/conf.py index 25f94f7b7d..9f6139ea4a 100644 --- a/src/doc/common/conf.py +++ b/src/doc/common/conf.py @@ -622,9 +622,9 @@ def call_intersphinx(app, env, node, contnode): Check that the link from the thematic tutorials to the reference manual is relative, see :trac:`20118`:: - sage: from sage.env import SAGE_DOC - sage: thematic_index = os.path.join(SAGE_DOC, "html", "en", "thematic_tutorials", "index.html") - sage: for line in open(thematic_index).readlines(): + sage: from sage.env import SAGE_DOC # optional - dochtml + sage: thematic_index = os.path.join(SAGE_DOC, "html", "en", "thematic_tutorials", "index.html") # optional - dochtml + sage: for line in open(thematic_index).readlines(): # optional - dochtml ....: if "padics" in line: ....: sys.stdout.write(line)
  • Introduction to the -adics
  • diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index 4236fd05e0..8e499cbaf7 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -87,7 +87,7 @@ class DocTestDefaults(SageObject): self.sagenb = False self.long = False self.warn_long = None - self.optional = set(['sage']) | auto_optional_tags + self.optional = set(['sage', 'dochtml']) | auto_optional_tags self.randorder = None self.global_iterations = 1 # sage-runtests default is 0 self.file_iterations = 1 # sage-runtests default is 0 @@ -343,7 +343,8 @@ class DocTestController(SageObject): if not optionaltag_regex.search(o): raise ValueError('invalid optional tag {!r}'.format(o)) - options.optional |= auto_optional_tags + if "sage" in options.optional: + options.optional |= auto_optional_tags self.options = options self.files = args @@ -741,7 +742,7 @@ class DocTestController(SageObject): sage: DC = DocTestController(DD, [dirname]) sage: DC.expand_files_into_sources() sage: sorted(DC.sources[0].options.optional) # abs tol 1 - ['guava', 'magma', 'py3'] + ['guava', 'magma'] We check that files are skipped appropriately:: @@ -968,7 +969,7 @@ class DocTestController(SageObject): sage: from sage.doctest.control import DocTestDefaults, DocTestController sage: DC = DocTestController(DocTestDefaults(), []) sage: DC._optional_tags_string() - 'sage' + 'dochtml,sage' sage: DC = DocTestController(DocTestDefaults(optional="all,and,some,more"), []) sage: DC._optional_tags_string() 'all' diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 9255aa848f..cc4712d3ec 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -18,9 +18,9 @@ TESTS: Check that argspecs of extension function/methods appear correctly, see :trac:`12849`:: - sage: from sage.env import SAGE_DOC - sage: docfilename = os.path.join(SAGE_DOC, 'html', 'en', 'reference', 'calculus', 'sage', 'symbolic', 'expression.html') - sage: with open(docfilename) as fobj: + sage: from sage.env import SAGE_DOC # optional - dochtml + sage: docfilename = os.path.join(SAGE_DOC, 'html', 'en', 'reference', 'calculus', 'sage', 'symbolic', 'expression.html') # optional - dochtml + sage: with open(docfilename) as fobj: # optional - dochtml ....: for line in fobj: ....: if "#sage.symbolic.expression.Expression.numerical_approx" in line: ....: print(line) @@ -790,11 +790,12 @@ def _search_src_or_doc(what, string, extra1='', extra2='', extra3='', :: - sage: len(_search_src_or_doc('src', r'matrix\(', 'incidence_structures', 'self', 'combinat', interact=False).splitlines()) > 1 + sage: from sage.misc.sagedoc import _search_src_or_doc # optional - dochtml + sage: len(_search_src_or_doc('src', r'matrix\(', 'incidence_structures', 'self', 'combinat', interact=False).splitlines()) > 1 # optional - dochtml True - sage: 'abvar/homology' in _search_src_or_doc('doc', 'homology', 'variety', interact=False) # long time (4s on sage.math, 2012) + sage: 'abvar/homology' in _search_src_or_doc('doc', 'homology', 'variety', interact=False) # optional - dochtml, long time (4s on sage.math, 2012) True - sage: 'divisors' in _search_src_or_doc('src', '^ *def prime', interact=False) + sage: 'divisors' in _search_src_or_doc('src', '^ *def prime', interact=False) # optional - dochtml True """ # process keywords @@ -1160,9 +1161,9 @@ def search_doc(string, extra1='', extra2='', extra3='', extra4='', counting the length of ``search_doc('tree', interact=False).splitlines()`` gives the number of matches. :: - sage: len(search_doc('tree', interact=False).splitlines()) > 4000 # long time + sage: len(search_doc('tree', interact=False).splitlines()) > 4000 # optional - dochtml, long time True - sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 2000 # long time + sage: len(search_doc('tree', whole_word=True, interact=False).splitlines()) < 2000 # optional - dochtml, long time True """ return _search_src_or_doc('doc', string, extra1=extra1, extra2=extra2, @@ -1332,9 +1333,9 @@ class _sage_doc: EXAMPLES:: - sage: browse_sage_doc._open("reference", testing=True)[0] # indirect doctest + sage: browse_sage_doc._open("reference", testing=True)[0] # optional - dochtml, indirect doctest 'http://localhost:8000/doc/live/reference/index.html' - sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47] + sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47] # optional - dochtml 'Full MatrixSpace of 3 by 3 sparse matrices over Integer Ring' """ def __init__(self): @@ -1494,9 +1495,9 @@ class _sage_doc: EXAMPLES:: - sage: browse_sage_doc._open("reference", testing=True)[0] + sage: browse_sage_doc._open("reference", testing=True)[0] # optional - dochtml 'http://localhost:8000/doc/live/reference/index.html' - sage: browse_sage_doc._open("tutorial", testing=True)[1] + sage: browse_sage_doc._open("tutorial", testing=True)[1] # optional - dochtml '.../html/en/tutorial/index.html' """ url = self._base_url + os.path.join(name, "index.html")