Skip to content

Commit 5f6dc88

Browse files
committed
Use python3 -m sage.doctest in doctest results report if not using sage-runtests
1 parent 665a3fa commit 5f6dc88

File tree

4 files changed

+58
-58
lines changed

4 files changed

+58
-58
lines changed

src/sage/doctest/control.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ def run_doctests(self):
11621162
sage: DC.expand_files_into_sources()
11631163
sage: DC.run_doctests()
11641164
Doctesting 1 file.
1165-
sage -t .../sage/rings/homset.py
1165+
.../sage/rings/homset.py
11661166
[... tests, ...s wall]
11671167
----------------------------------------------------------------------
11681168
All tests passed!
@@ -1239,7 +1239,7 @@ def cleanup(self, final=True):
12391239
sage: DC.run()
12401240
Running doctests with ID ...
12411241
Doctesting 1 file.
1242-
sage -t .../rings/all.py
1242+
.../rings/all.py
12431243
[... tests, ...s wall]
12441244
----------------------------------------------------------------------
12451245
All tests passed!
@@ -1443,7 +1443,7 @@ def run(self):
14431443
sage: DC.run()
14441444
Running doctests with ID ...
14451445
Doctesting 1 file.
1446-
sage -t .../sage/sets/non_negative_integers.py
1446+
.../sage/sets/non_negative_integers.py
14471447
[... tests, ...s wall]
14481448
----------------------------------------------------------------------
14491449
All tests passed!
@@ -1467,7 +1467,7 @@ def run(self):
14671467
Using --optional=external,sage
14681468
Features to be detected: ...
14691469
Doctesting 1 file.
1470-
sage -t ....py
1470+
....py
14711471
[0 tests, ...s wall]
14721472
----------------------------------------------------------------------
14731473
All tests passed!
@@ -1493,7 +1493,7 @@ def run(self):
14931493
Using --optional=sage...
14941494
Features to be detected: ...
14951495
Doctesting 1 file.
1496-
sage -t ....py
1496+
....py
14971497
[4 tests, ...s wall]
14981498
----------------------------------------------------------------------
14991499
All tests passed!
@@ -1511,7 +1511,7 @@ def run(self):
15111511
Using --optional=sage
15121512
Features to be detected: ...
15131513
Doctesting 1 file.
1514-
sage -t ....py
1514+
....py
15151515
[4 tests, ...s wall]
15161516
----------------------------------------------------------------------
15171517
All tests passed!
@@ -1637,7 +1637,7 @@ def run_doctests(module, options=None):
16371637
sage: run_doctests(sage.rings.all)
16381638
Running doctests with ID ...
16391639
Doctesting 1 file.
1640-
sage -t .../sage/rings/all.py
1640+
.../sage/rings/all.py
16411641
[... tests, ...s wall]
16421642
----------------------------------------------------------------------
16431643
All tests passed!

src/sage/doctest/forker.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,9 +1768,9 @@ def serial_dispatch(self):
17681768
sage: DC.dispatcher = DD
17691769
sage: DC.timer = Timer().start()
17701770
sage: DD.serial_dispatch()
1771-
sage -t .../rings/homset.py
1771+
.../rings/homset.py
17721772
[... tests, ...s wall]
1773-
sage -t .../rings/ideal.py
1773+
.../rings/ideal.py
17741774
[... tests, ...s wall]
17751775
"""
17761776
for source in self.controller.sources:
@@ -1814,9 +1814,9 @@ def parallel_dispatch(self):
18141814
sage: DC.dispatcher = DD
18151815
sage: DC.timer = Timer().start()
18161816
sage: DD.parallel_dispatch()
1817-
sage -t .../databases/cremona.py
1817+
.../databases/cremona.py
18181818
[... tests, ...s wall]
1819-
sage -t .../rings/big_oh.py
1819+
.../rings/big_oh.py
18201820
[... tests, ...s wall]
18211821
18221822
If the ``exitfirst=True`` option is given, the results for a failing
@@ -1840,7 +1840,7 @@ def parallel_dispatch(self):
18401840
....: DC.dispatcher = DD
18411841
....: DC.timer = Timer().start()
18421842
....: DD.parallel_dispatch()
1843-
sage -t ...
1843+
...
18441844
**********************************************************************
18451845
File "...", line 2, in ...
18461846
Failed example:
@@ -2145,9 +2145,9 @@ def dispatch(self):
21452145
sage: DC.dispatcher = DD
21462146
sage: DC.timer = Timer().start()
21472147
sage: DD.dispatch()
2148-
sage -t .../sage/modules/free_module_homspace.py
2148+
.../sage/modules/free_module_homspace.py
21492149
[... tests, ...s wall]
2150-
sage -t .../sage/rings/big_oh.py
2150+
.../sage/rings/big_oh.py
21512151
[... tests, ...s wall]
21522152
"""
21532153
if self.controller.options.serial:
@@ -2209,7 +2209,7 @@ def __init__(self, source, options, funclist=[], baseline=None):
22092209
sage: run_doctests(sage.rings.big_oh) # indirect doctest
22102210
Running doctests with ID ...
22112211
Doctesting 1 file.
2212-
sage -t .../sage/rings/big_oh.py
2212+
.../sage/rings/big_oh.py
22132213
[... tests, ...s wall]
22142214
----------------------------------------------------------------------
22152215
All tests passed!
@@ -2256,7 +2256,7 @@ def run(self):
22562256
sage: run_doctests(sage.symbolic.units) # indirect doctest # needs sage.symbolic
22572257
Running doctests with ID ...
22582258
Doctesting 1 file.
2259-
sage -t .../sage/symbolic/units.py
2259+
.../sage/symbolic/units.py
22602260
[... tests, ...s wall]
22612261
----------------------------------------------------------------------
22622262
All tests passed!

src/sage/doctest/reporting.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# ****************************************************************************
4343

4444
import re
45-
from sys import stdout
45+
from sys import argv, stdout
4646
from signal import (SIGABRT, SIGALRM, SIGBUS, SIGFPE, SIGHUP, SIGILL,
4747
SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGTERM)
4848
from sage.structure.sage_object import SageObject
@@ -183,17 +183,17 @@ def report_head(self, source, fail_msg=None):
183183
sage: DC = DocTestController(DD, [filename])
184184
sage: DTR = DocTestReporter(DC)
185185
sage: print(DTR.report_head(FDS))
186-
sage -t .../sage/doctest/reporting.py
186+
.../sage/doctest/reporting.py
187187
188188
The same with various options::
189189
190190
sage: DD.long = True
191191
sage: print(DTR.report_head(FDS))
192-
sage -t --long .../sage/doctest/reporting.py
192+
... --long .../sage/doctest/reporting.py
193193
sage: print(DTR.report_head(FDS, "Failed by self-sabotage"))
194-
sage -t --long .../sage/doctest/reporting.py # Failed by self-sabotage
194+
... --long .../sage/doctest/reporting.py # Failed by self-sabotage
195195
"""
196-
cmd = "sage -t"
196+
cmd = "sage-runtests" if "sage-runtests" in argv[0] else "python3 -m sage.doctest"
197197
if self.controller.options.long:
198198
cmd += " --long"
199199

@@ -695,9 +695,9 @@ def finalize(self):
695695
sage: DC.sources = [None] * 4 # to fool the finalize method
696696
sage: DTR.finalize()
697697
----------------------------------------------------------------------
698-
sage -t .../sage/doctest/reporting.py # Timed out
699-
sage -t .../sage/doctest/reporting.py # Bad exit: 3
700-
sage -t .../sage/doctest/reporting.py # 1 doctest failed
698+
.../sage/doctest/reporting.py # Timed out
699+
.../sage/doctest/reporting.py # Bad exit: 3
700+
.../sage/doctest/reporting.py # 1 doctest failed
701701
----------------------------------------------------------------------
702702
Total time for all tests: 0.0 seconds
703703
cpu time: 0.0 seconds
@@ -710,9 +710,9 @@ def finalize(self):
710710
sage: DTR.finalize()
711711
<BLANKLINE>
712712
----------------------------------------------------------------------
713-
sage -t .../sage/doctest/reporting.py # Timed out
714-
sage -t .../sage/doctest/reporting.py # Bad exit: 3
715-
sage -t .../sage/doctest/reporting.py # 1 doctest failed
713+
.../sage/doctest/reporting.py # Timed out
714+
.../sage/doctest/reporting.py # Bad exit: 3
715+
.../sage/doctest/reporting.py # 1 doctest failed
716716
Doctests interrupted: 4/6 files tested
717717
----------------------------------------------------------------------
718718
Total time for all tests: 0.0 seconds

0 commit comments

Comments
 (0)