Skip to content

Commit 23e9923

Browse files
author
Matthias Koeppe
committed
src/sage/doctest/reporting.py: Update doctest output
1 parent f495618 commit 23e9923

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/sage/doctest/reporting.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ def report(self, source, timeout, return_code, results, output, pid=None):
264264
Output so far...
265265
**********************************************************************
266266
sage: DTR.stats
267-
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
267+
{'sage.doctest.reporting': {'failed': True,
268+
'ntests': 0,
269+
'walltime': 1000000.0}}
268270
269271
Or a process that returned a bad exit code::
270272
@@ -275,7 +277,9 @@ def report(self, source, timeout, return_code, results, output, pid=None):
275277
Output before trouble
276278
**********************************************************************
277279
sage: DTR.stats
278-
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
280+
{'sage.doctest.reporting': {'failed': True,
281+
'ntests': 0,
282+
'walltime': 1000000.0}}
279283
280284
Or a process that segfaulted::
281285
@@ -287,7 +291,9 @@ def report(self, source, timeout, return_code, results, output, pid=None):
287291
Output before trouble
288292
**********************************************************************
289293
sage: DTR.stats
290-
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
294+
{'sage.doctest.reporting': {'failed': True,
295+
'ntests': 0,
296+
'walltime': 1000000.0}}
291297
292298
Report a timeout with results and a ``SIGKILL``::
293299
@@ -299,7 +305,9 @@ def report(self, source, timeout, return_code, results, output, pid=None):
299305
Output before trouble
300306
**********************************************************************
301307
sage: DTR.stats
302-
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
308+
{'sage.doctest.reporting': {'failed': True,
309+
'ntests': 1,
310+
'walltime': 1000000.0}}
303311
304312
This is an internal error since results is None::
305313
@@ -310,20 +318,23 @@ def report(self, source, timeout, return_code, results, output, pid=None):
310318
All output
311319
**********************************************************************
312320
sage: DTR.stats
313-
{'sage.doctest.reporting': {'failed': True, 'walltime': 1000000.0}}
321+
{'sage.doctest.reporting': {'failed': True,
322+
'ntests': 1,
323+
'walltime': 1000000.0}}
314324
315325
Or tell the user that everything succeeded::
316326
317327
sage: doctests, extras = FDS.create_doctests(globals())
318-
sage: runner = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
328+
sage: runner = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD,
329+
....: optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
319330
sage: Timer().start().stop().annotate(runner)
320331
sage: D = DictAsObject({'err':None})
321332
sage: runner.update_results(D)
322333
0
323334
sage: DTR.report(FDS, False, 0, (sum([len(t.examples) for t in doctests]), D), "Good tests")
324335
[... tests, ... s]
325336
sage: DTR.stats
326-
{'sage.doctest.reporting': {'walltime': ...}}
337+
{'sage.doctest.reporting': {'ntests': ..., 'walltime': ...}}
327338
328339
Or inform the user that some doctests failed::
329340
@@ -366,7 +377,8 @@ def report(self, source, timeout, return_code, results, output, pid=None):
366377
sage: DC = DocTestController(DD, [filename])
367378
sage: DTR = DocTestReporter(DC)
368379
sage: doctests, extras = FDS.create_doctests(globals())
369-
sage: runner = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
380+
sage: runner = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD,
381+
....: optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
370382
sage: Timer().start().stop().annotate(runner)
371383
sage: D = DictAsObject({'err':None})
372384
sage: runner.update_results(D)

0 commit comments

Comments
 (0)