Skip to content

Commit

Permalink
Merge pull request sagemath#160 from passagemath/sage.doctest-needs
Browse files Browse the repository at this point in the history
`sage.doctest`: Add `# needs`
  • Loading branch information
mkoeppe authored Oct 24, 2024
2 parents 5e763e3 + d7c1675 commit c98ca9e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
9 changes: 4 additions & 5 deletions pkgs/sagemath-categories/known-test-failures.json
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,7 @@
"ntests": 19
},
"sage.doctest.control": {
"failed": true,
"ntests": 229
"ntests": 3
},
"sage.doctest.external": {
"ntests": 42
Expand All @@ -784,15 +783,15 @@
},
"sage.doctest.forker": {
"failed": true,
"ntests": 0
"ntests": 366
},
"sage.doctest.marked_output": {
"failed": true,
"ntests": 21
},
"sage.doctest.parsing": {
"failed": true,
"ntests": 275
"ntests": 270
},
"sage.doctest.reporting": {
"ntests": 126
Expand Down Expand Up @@ -1537,7 +1536,7 @@
},
"sage.rings.fraction_field": {
"failed": true,
"ntests": 197
"ntests": 193
},
"sage.rings.fraction_field_element": {
"failed": true,
Expand Down
5 changes: 3 additions & 2 deletions src/sage/doctest/control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# sage_setup: distribution = sagemath-repl
# sage.doctest: needs sage.all
"""
Classes involved in doctesting
Expand Down Expand Up @@ -674,10 +675,10 @@ def load_environment(self):
sage: from sage.doctest.control import DocTestDefaults, DocTestController
sage: DC = DocTestController(DocTestDefaults(), [])
sage: 'BipartiteGraph' in DC.load_environment().__dict__
sage: 'BipartiteGraph' in DC.load_environment().__dict__ # needs sage.graphs
True
sage: DC = DocTestController(DocTestDefaults(environment='sage.doctest.all'), [])
sage: 'BipartiteGraph' in DC.load_environment().__dict__
sage: 'BipartiteGraph' in DC.load_environment().__dict__ # needs sage.graphs
False
sage: 'run_doctests' in DC.load_environment().__dict__
True
Expand Down
2 changes: 1 addition & 1 deletion src/sage/doctest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def reproducible_repr(val):
frozenset(['a', 'b', 'c', 'd'])
sage: print(reproducible_repr([1, frozenset("cab"), set("bar"), 0]))
[1, frozenset(['a', 'b', 'c']), set(['a', 'b', 'r']), 0]
sage: print(reproducible_repr({3.0: "three", "2": "two", 1: "one"})) # optional - sage.rings.real_mpfr
sage: print(reproducible_repr({3.0: "three", "2": "two", 1: "one"})) # needs sage.rings.real_mpfr
{'2': 'two', 1: 'one', 3.00000000000000: 'three'}
sage: print(reproducible_repr("foo\nbar")) # demonstrate default case
'foo\nbar'
Expand Down
3 changes: 3 additions & 0 deletions src/sage/doctest/forker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,7 @@ def report_failure(self, out, test, example, got, globs):
If debugging is turned on this function starts an IPython
prompt when a test returns an incorrect answer::
sage: # needs sage.symbolic (actually sage.all)
sage: sage0.quit()
sage: _ = sage0.eval("import doctest, sys, os, multiprocessing, subprocess")
sage: _ = sage0.eval("from sage.doctest.parsing import SageOutputChecker")
Expand Down Expand Up @@ -1562,6 +1563,7 @@ def report_unexpected_exception(self, out, test, example, exc_info):
EXAMPLES::
sage: # needs sage.symbolic (actually sage.all)
sage: from sage.interfaces.sage0 import sage0
sage: sage0.quit()
sage: _ = sage0.eval("import doctest, sys, os, multiprocessing, subprocess")
Expand Down Expand Up @@ -2102,6 +2104,7 @@ def dispatch(self):
EXAMPLES::
sage: # needs sage.modules
sage: from sage.doctest.control import DocTestController, DocTestDefaults
sage: from sage.doctest.forker import DocTestDispatcher
sage: from sage.doctest.reporting import DocTestReporter
Expand Down
6 changes: 4 additions & 2 deletions src/sage/doctest/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def parse_tolerance(source, want):
0
sage: marked.rel_tol
0
sage: marked.abs_tol
sage: marked.abs_tol # needs sage.rings.real_mpfr
0.010000000000000000000...?
"""
# regular expressions
Expand Down Expand Up @@ -870,7 +870,7 @@ def parse(self, string, *args):
'0.893515349287690\n'
sage: type(ex.want)
<class 'sage.doctest.marked_output.MarkedOutput'>
sage: ex.want.tol
sage: ex.want.tol # needs sage.rings.real_interval_field
2.000000000000000000...?e-11
You can use continuation lines::
Expand Down Expand Up @@ -1208,6 +1208,8 @@ class SageOutputChecker(doctest.OutputChecker):
'0.893515349287690\n'
sage: type(ex.want)
<class 'sage.doctest.marked_output.MarkedOutput'>
sage: # needs sage.rings.real_interval_field
sage: ex.want.tol
2.000000000000000000...?e-11
sage: OC.check_output(ex.want, '0.893515349287690', optflag)
Expand Down
6 changes: 3 additions & 3 deletions src/sage/doctest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ def annotate(self, object):
sage: # needs sage.schemes
sage: from sage.doctest.util import Timer
sage: Timer().start().annotate(EllipticCurve)
sage: EllipticCurve.cputime # random
sage: Timer().start().annotate(EllipticCurve) # needs sage.schemes
sage: EllipticCurve.cputime # random # needs sage.schemes
2.817255
sage: EllipticCurve.walltime # random
sage: EllipticCurve.walltime # random # needs sage.schemes
1332649288.410404
"""
object.cputime = self.cputime
Expand Down
1 change: 1 addition & 0 deletions src/sage/structure/coerce.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ cdef class CoercionModel:
Check that :issue:`8426` is fixed (see also :issue:`18076`)::
sage: # needs sage.rings.real_mpfr
sage: import numpy # needs numpy
sage: if int(numpy.version.short_version[0]) > 1: # needs numpy
....: numpy.set_printoptions(legacy="1.25") # needs numpy
Expand Down

0 comments on commit c98ca9e

Please sign in to comment.