Skip to content

Use python3 -m sage.doctest in doctest results report if not using sage-runtests #40332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/sage/doctest/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ def run_doctests(self):
sage: DC.expand_files_into_sources()
sage: DC.run_doctests()
Doctesting 1 file.
sage -t .../sage/rings/homset.py
.../sage/rings/homset.py
[... tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand Down Expand Up @@ -1239,7 +1239,7 @@ def cleanup(self, final=True):
sage: DC.run()
Running doctests with ID ...
Doctesting 1 file.
sage -t .../rings/all.py
.../rings/all.py
[... tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand Down Expand Up @@ -1443,7 +1443,7 @@ def run(self):
sage: DC.run()
Running doctests with ID ...
Doctesting 1 file.
sage -t .../sage/sets/non_negative_integers.py
.../sage/sets/non_negative_integers.py
[... tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand All @@ -1467,7 +1467,7 @@ def run(self):
Using --optional=external,sage
Features to be detected: ...
Doctesting 1 file.
sage -t ....py
....py
[0 tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand All @@ -1493,7 +1493,7 @@ def run(self):
Using --optional=sage...
Features to be detected: ...
Doctesting 1 file.
sage -t ....py
....py
[4 tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand All @@ -1511,7 +1511,7 @@ def run(self):
Using --optional=sage
Features to be detected: ...
Doctesting 1 file.
sage -t ....py
....py
[4 tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand Down Expand Up @@ -1637,7 +1637,7 @@ def run_doctests(module, options=None):
sage: run_doctests(sage.rings.all)
Running doctests with ID ...
Doctesting 1 file.
sage -t .../sage/rings/all.py
.../sage/rings/all.py
[... tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand Down
18 changes: 9 additions & 9 deletions src/sage/doctest/forker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1768,9 +1768,9 @@
sage: DC.dispatcher = DD
sage: DC.timer = Timer().start()
sage: DD.serial_dispatch()
sage -t .../rings/homset.py
.../rings/homset.py
[... tests, ...s wall]
sage -t .../rings/ideal.py
.../rings/ideal.py
[... tests, ...s wall]
"""
for source in self.controller.sources:
Expand Down Expand Up @@ -1814,9 +1814,9 @@
sage: DC.dispatcher = DD
sage: DC.timer = Timer().start()
sage: DD.parallel_dispatch()
sage -t .../databases/cremona.py
.../databases/cremona.py
[... tests, ...s wall]
sage -t .../rings/big_oh.py
.../rings/big_oh.py
[... tests, ...s wall]

If the ``exitfirst=True`` option is given, the results for a failing
Expand All @@ -1840,7 +1840,7 @@
....: DC.dispatcher = DD
....: DC.timer = Timer().start()
....: DD.parallel_dispatch()
sage -t ...
...
**********************************************************************
File "...", line 2, in ...
Failed example:
Expand Down Expand Up @@ -2145,9 +2145,9 @@
sage: DC.dispatcher = DD
sage: DC.timer = Timer().start()
sage: DD.dispatch()
sage -t .../sage/modules/free_module_homspace.py
.../sage/modules/free_module_homspace.py
[... tests, ...s wall]
sage -t .../sage/rings/big_oh.py
.../sage/rings/big_oh.py
[... tests, ...s wall]
"""
if self.controller.options.serial:
Expand Down Expand Up @@ -2195,7 +2195,7 @@
sage: W.start()
sage: DC = DocTestController(DD, filename)
sage: reporter = DocTestReporter(DC)
sage: W.join() # Wait for worker to finish

Check warning on line 2198 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2198 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2198 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2198 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Warning: slow doctest:

slow doctest:

Check warning on line 2198 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Warning: slow doctest:

slow doctest:
sage: result = W.result_queue.get()
sage: reporter.report(FDS, False, W.exitcode, result, "")
[... tests, ...s wall]
Expand All @@ -2209,7 +2209,7 @@
sage: run_doctests(sage.rings.big_oh) # indirect doctest
Running doctests with ID ...
Doctesting 1 file.
sage -t .../sage/rings/big_oh.py
.../sage/rings/big_oh.py
[... tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand Down Expand Up @@ -2256,7 +2256,7 @@
sage: run_doctests(sage.symbolic.units) # indirect doctest # needs sage.symbolic
Running doctests with ID ...
Doctesting 1 file.
sage -t .../sage/symbolic/units.py
.../sage/symbolic/units.py
[... tests, ...s wall]
----------------------------------------------------------------------
All tests passed!
Expand Down Expand Up @@ -2322,7 +2322,7 @@
....: except OSError:
....: print("Write end of pipe successfully closed")
Write end of pipe successfully closed
sage: W.join() # Wait for worker to finish

Check warning on line 2325 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2325 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2325 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2325 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Warning: slow doctest:

slow doctest:

Check warning on line 2325 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Warning: slow doctest:

slow doctest:
"""
super().start()

Expand Down Expand Up @@ -2358,7 +2358,7 @@
sage: W.start()
sage: while W.rmessages is not None:
....: W.read_messages()
sage: W.join()

Check warning on line 2361 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2361 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2361 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2361 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Warning: slow doctest:

slow doctest:

Check warning on line 2361 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Warning: slow doctest:

slow doctest:
sage: len(W.messages) > 0
True
"""
Expand Down Expand Up @@ -2390,7 +2390,7 @@
sage: FDS = FileDocTestSource(filename, DD)
sage: W = DocTestWorker(FDS, DD)
sage: W.start()
sage: W.join()

Check warning on line 2393 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2393 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.12, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2393 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.11, all)

Warning: slow doctest:

slow doctest:

Check warning on line 2393 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all, editable)

Warning: slow doctest:

slow doctest:

Check warning on line 2393 in src/sage/doctest/forker.py

View workflow job for this annotation

GitHub Actions / Conda (ubuntu, Python 3.12, all)

Warning: slow doctest:

slow doctest:
sage: W.save_result_output()
sage: sorted(W.result[1].keys())
['cputime', 'err', 'failures', 'optionals', 'tests', 'walltime', 'walltime_skips']
Expand Down
22 changes: 11 additions & 11 deletions src/sage/doctest/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# ****************************************************************************

import re
from sys import stdout
from sys import argv, stdout
from signal import (SIGABRT, SIGALRM, SIGBUS, SIGFPE, SIGHUP, SIGILL,
SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGTERM)
from sage.structure.sage_object import SageObject
Expand Down Expand Up @@ -183,17 +183,17 @@ def report_head(self, source, fail_msg=None):
sage: DC = DocTestController(DD, [filename])
sage: DTR = DocTestReporter(DC)
sage: print(DTR.report_head(FDS))
sage -t .../sage/doctest/reporting.py
.../sage/doctest/reporting.py

The same with various options::

sage: DD.long = True
sage: print(DTR.report_head(FDS))
sage -t --long .../sage/doctest/reporting.py
... --long .../sage/doctest/reporting.py
sage: print(DTR.report_head(FDS, "Failed by self-sabotage"))
sage -t --long .../sage/doctest/reporting.py # Failed by self-sabotage
... --long .../sage/doctest/reporting.py # Failed by self-sabotage
"""
cmd = "sage -t"
cmd = "sage-runtests" if "sage-runtests" in argv[0] else "python3 -m sage.doctest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change it from sage -t to sage-runtests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to minimize the wrapping layers - I didn't make it python3 -m sage.doctest unconditionally because sage may not be installed in the system python namespace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay!

if self.controller.options.long:
cmd += " --long"

Expand Down Expand Up @@ -695,9 +695,9 @@ def finalize(self):
sage: DC.sources = [None] * 4 # to fool the finalize method
sage: DTR.finalize()
----------------------------------------------------------------------
sage -t .../sage/doctest/reporting.py # Timed out
sage -t .../sage/doctest/reporting.py # Bad exit: 3
sage -t .../sage/doctest/reporting.py # 1 doctest failed
.../sage/doctest/reporting.py # Timed out
.../sage/doctest/reporting.py # Bad exit: 3
.../sage/doctest/reporting.py # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 0.0 seconds
cpu time: 0.0 seconds
Expand All @@ -710,9 +710,9 @@ def finalize(self):
sage: DTR.finalize()
<BLANKLINE>
----------------------------------------------------------------------
sage -t .../sage/doctest/reporting.py # Timed out
sage -t .../sage/doctest/reporting.py # Bad exit: 3
sage -t .../sage/doctest/reporting.py # 1 doctest failed
.../sage/doctest/reporting.py # Timed out
.../sage/doctest/reporting.py # Bad exit: 3
.../sage/doctest/reporting.py # 1 doctest failed
Doctests interrupted: 4/6 files tested
----------------------------------------------------------------------
Total time for all tests: 0.0 seconds
Expand Down
Loading
Loading