Skip to content

Commit 2cc817d

Browse files
author
Release Manager
committed
gh-40236: Use 'python -m sage.doctest' instead of 'sage -t' <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> Since `sage -t` is not working with meson. Progress towards #39875 (not sure if I got all of them). ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #40236 Reported by: Tobias Diez Reviewer(s):
2 parents 72e5b31 + d0d96e3 commit 2cc817d

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

src/sage/doctest/test.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
sage: import signal
1111
sage: import subprocess
1212
sage: import time
13+
sage: import os
1314
sage: from sage.env import SAGE_SRC
1415
sage: tests_dir = os.path.join(SAGE_SRC, 'sage', 'doctest', 'tests')
1516
sage: tests_env = dict(os.environ)
@@ -24,7 +25,7 @@
2425
2526
Check that :issue:`2235` has been fixed::
2627
27-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
28+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
2829
....: "--random-seed=0", "--optional=sage", "longtime.rst"], **kwds)
2930
Running doctests...
3031
Doctesting 1 file.
@@ -35,7 +36,7 @@
3536
----------------------------------------------------------------------
3637
...
3738
0
38-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
39+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
3940
....: "--random-seed=0", "--optional=sage", "-l", "longtime.rst"], **kwds)
4041
Running doctests...
4142
Doctesting 1 file.
@@ -49,7 +50,7 @@
4950
5051
Check handling of tolerances::
5152
52-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
53+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
5354
....: "--random-seed=0", "--optional=sage", "tolerance.rst"], **kwds)
5455
Running doctests...
5556
Doctesting 1 file.
@@ -119,7 +120,7 @@
119120
120121
Test the ``--initial`` option::
121122
122-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
123+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
123124
....: "--random-seed=0", "--optional=sage", "-i", "initial.rst"], **kwds)
124125
Running doctests...
125126
Doctesting 1 file.
@@ -150,7 +151,7 @@
150151
151152
Test the ``--exitfirst`` option::
152153
153-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
154+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
154155
....: "--random-seed=0", "--optional=sage", "--exitfirst", "initial.rst"], **kwds)
155156
Running doctests...
156157
Doctesting 1 file.
@@ -178,7 +179,7 @@
178179
sage: from copy import deepcopy
179180
sage: kwds2 = deepcopy(kwds)
180181
sage: kwds2['env'].update({'SAGE_TIMEOUT': '1', 'CYSIGNALS_CRASH_NDEBUG': '1'})
181-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
182+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
182183
....: "--random-seed=0", "--optional=sage", "99seconds.rst"], **kwds2)
183184
Running doctests...
184185
Doctesting 1 file.
@@ -195,7 +196,7 @@
195196
196197
Test handling of ``KeyboardInterrupt`` in doctests::
197198
198-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
199+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
199200
....: "--random-seed=0", "--optional=sage", "keyboardinterrupt.rst"], **kwds)
200201
Running doctests...
201202
Doctesting 1 file.
@@ -218,7 +219,7 @@
218219
219220
Interrupt the doctester::
220221
221-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
222+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
222223
....: "--random-seed=0", "--optional=sage", "interrupt.rst"], **kwds)
223224
Running doctests...
224225
Doctesting 1 file.
@@ -237,7 +238,7 @@
237238
sage: from copy import deepcopy
238239
sage: kwds2 = deepcopy(kwds)
239240
sage: kwds2['env']['DOCTEST_TEST_PID_FILE'] = F # Doctester will write its PID in this file
240-
sage: subprocess.call(["sage", "-tp", "1000000", "--timeout=120", # long time
241+
sage: subprocess.call(["python3", "-m", "sage.doctest", "-p", "1000000", "--timeout=120", # long time
241242
....: "--die_timeout=10", "--optional=sage",
242243
....: "--warn-long", "0", "99seconds.rst", "interrupt_diehard.rst"], **kwds2)
243244
Running doctests...
@@ -273,7 +274,7 @@
273274
274275
Test a doctest failing with ``abort()``::
275276
276-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
277+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
277278
....: "--random-seed=0", "--optional=sage", "abort.rst"], **kwds)
278279
Running doctests...
279280
Doctesting 1 file.
@@ -299,7 +300,7 @@
299300
represented by ``<DOTSCOLON>`` below)::
300301
301302
sage: # long time
302-
sage: proc = subprocess.run(["sage", "-t", "--warn-long", "0",
303+
sage: proc = subprocess.run(["python3", "-m", "sage.doctest", "--warn-long", "0",
303304
....: "--random-seed=0", "--optional=sage", "fail_and_die.rst"], **kwds,
304305
....: stdout=subprocess.PIPE, text=True)
305306
sage: # the replacements are needed to avoid the strings being interpreted
@@ -335,7 +336,7 @@
335336
336337
Test that ``sig_on_count`` is checked correctly::
337338
338-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
339+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
339340
....: "--random-seed=0", "--optional=sage", "sig_on.rst"], **kwds)
340341
Running doctests...
341342
Doctesting 1 file.
@@ -361,7 +362,7 @@
361362
Test logfiles in serial and parallel mode (see :issue:`19271`)::
362363
363364
sage: t = tmp_filename()
364-
sage: subprocess.call(["sage", "-t", "--serial", "--warn-long", "0", # long time
365+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--serial", "--warn-long", "0", # long time
365366
....: "--random-seed=0", "--optional=sage", "--logfile", t, "simple_failure.rst"],
366367
....: stdout=open(os.devnull, "w"), **kwds)
367368
1
@@ -386,7 +387,7 @@
386387
----------------------------------------------------------------------
387388
...
388389
389-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
390+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
390391
....: "--random-seed=0", "--optional=sage", "--logfile", t, "simple_failure.rst"],
391392
....: stdout=open(os.devnull, "w"), **kwds)
392393
1
@@ -413,7 +414,7 @@
413414
414415
Test the ``--debug`` option::
415416
416-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
417+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
417418
....: "--random-seed=0", "--optional=sage", "--debug", "simple_failure.rst"],
418419
....: stdin=open(os.devnull), **kwds)
419420
Running doctests...
@@ -448,7 +449,7 @@
448449
449450
Test running under gdb, without and with a timeout::
450451
451-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time, optional: gdb
452+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time, optional: gdb
452453
....: "--random-seed=0", "--optional=sage", "--gdb", "1second.rst"],
453454
....: stdin=open(os.devnull), **kwds)
454455
exec gdb ...
@@ -464,7 +465,7 @@
464465
465466
gdb might need a long time to start up, so we allow 30 seconds::
466467
467-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time, optional: gdb
468+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time, optional: gdb
468469
....: "--random-seed=0", "--optional=sage", "--gdb", "-T30", "99seconds.rst"],
469470
....: stdin=open(os.devnull), **kwds)
470471
exec gdb ...
@@ -474,7 +475,7 @@
474475
475476
Test the ``--show-skipped`` option::
476477
477-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
478+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
478479
....: "--random-seed=0", "--optional=sage", "--show-skipped", "show_skipped.rst"], **kwds)
479480
Running doctests ...
480481
Doctesting 1 file.
@@ -493,7 +494,7 @@
493494
494495
Optional tests are run correctly::
495496
496-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", "--long", # long time
497+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", "--long", # long time
497498
....: "--random-seed=0", "--show-skipped", "--optional=sage,gap", "show_skipped.rst"], **kwds)
498499
Running doctests ...
499500
Doctesting 1 file.
@@ -508,7 +509,7 @@
508509
...
509510
0
510511
511-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", "--long", # long time
512+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", "--long", # long time
512513
....: "--random-seed=0", "--show-skipped", "--optional=gAp", "show_skipped.rst"], **kwds)
513514
Running doctests ...
514515
Doctesting 1 file.
@@ -526,7 +527,7 @@
526527
527528
Test an invalid value for ``--optional``::
528529
529-
sage: subprocess.call(["sage", "-t", "--warn-long", "0",
530+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0",
530531
....: "--random-seed=0", "--optional=bad-option", "show_skipped.rst"], **kwds)
531532
Traceback (most recent call last):
532533
...
@@ -541,7 +542,7 @@
541542
sage: from copy import deepcopy
542543
sage: kwds2 = deepcopy(kwds)
543544
sage: kwds2['env']['DOCTEST_DELETE_FILE'] = F
544-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
545+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
545546
....: "--random-seed=0", "--optional=sage", "atexit.rst"], **kwds2)
546547
Running doctests...
547548
Doctesting 1 file.
@@ -561,7 +562,7 @@
561562
562563
Test that random tests are reproducible::
563564
564-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
565+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
565566
....: "--random-seed=0", "--optional=sage", "random_seed.rst"], **kwds)
566567
Running doctests...
567568
Doctesting 1 file.
@@ -583,7 +584,7 @@
583584
----------------------------------------------------------------------
584585
...
585586
1
586-
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
587+
sage: subprocess.call(["python3", "-m", "sage.doctest", "--warn-long", "0", # long time
587588
....: "--random-seed=1", "--optional=sage", "random_seed.rst"], **kwds)
588589
Running doctests...
589590
Doctesting 1 file.

0 commit comments

Comments
 (0)