Skip to content

Commit

Permalink
src/sage/doctest/reporting.py: Update doctest output
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Sep 21, 2023
1 parent f495618 commit 23e9923
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/sage/doctest/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ def report(self, source, timeout, return_code, results, output, pid=None):
Output so far...
**********************************************************************
sage: DTR.stats
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
{'sage.doctest.reporting': {'failed': True,
'ntests': 0,
'walltime': 1000000.0}}
Or a process that returned a bad exit code::
Expand All @@ -275,7 +277,9 @@ def report(self, source, timeout, return_code, results, output, pid=None):
Output before trouble
**********************************************************************
sage: DTR.stats
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
{'sage.doctest.reporting': {'failed': True,
'ntests': 0,
'walltime': 1000000.0}}
Or a process that segfaulted::
Expand All @@ -287,7 +291,9 @@ def report(self, source, timeout, return_code, results, output, pid=None):
Output before trouble
**********************************************************************
sage: DTR.stats
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
{'sage.doctest.reporting': {'failed': True,
'ntests': 0,
'walltime': 1000000.0}}
Report a timeout with results and a ``SIGKILL``::
Expand All @@ -299,7 +305,9 @@ def report(self, source, timeout, return_code, results, output, pid=None):
Output before trouble
**********************************************************************
sage: DTR.stats
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
{'sage.doctest.reporting': {'failed': True,
'ntests': 1,
'walltime': 1000000.0}}
This is an internal error since results is None::
Expand All @@ -310,20 +318,23 @@ def report(self, source, timeout, return_code, results, output, pid=None):
All output
**********************************************************************
sage: DTR.stats
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
{'sage.doctest.reporting': {'failed': True,
'ntests': 1,
'walltime': 1000000.0}}
Or tell the user that everything succeeded::
sage: doctests, extras = FDS.create_doctests(globals())
sage: runner = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
sage: runner = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD,
....: optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
sage: Timer().start().stop().annotate(runner)
sage: D = DictAsObject({'err':None})
sage: runner.update_results(D)
0
sage: DTR.report(FDS, False, 0, (sum([len(t.examples) for t in doctests]), D), "Good tests")
[... tests, ... s]
sage: DTR.stats
{'sage.doctest.reporting': {'walltime': ...}}
{'sage.doctest.reporting': {'ntests': ..., 'walltime': ...}}
Or inform the user that some doctests failed::
Expand Down Expand Up @@ -366,7 +377,8 @@ def report(self, source, timeout, return_code, results, output, pid=None):
sage: DC = DocTestController(DD, [filename])
sage: DTR = DocTestReporter(DC)
sage: doctests, extras = FDS.create_doctests(globals())
sage: runner = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
sage: runner = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD,
....: optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
sage: Timer().start().stop().annotate(runner)
sage: D = DictAsObject({'err':None})
sage: runner.update_results(D)
Expand Down

0 comments on commit 23e9923

Please sign in to comment.