From 272f6af5b2037cf4bba6586d65aa22d92ab2f605 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 9 Feb 2022 08:01:40 -0500 Subject: [PATCH] src/sage/doctest/forker.py: report verbose doctest success in CPU time Since we're now warning about tests that take too many cpu-seconds (as opposed to too many wall-seconds), it makes sense to report the time taken in cpu-seconds as well. This allows you to better judge how close a test is to being a "long" test. The output format remains unchanged, for example, ok [1.02 s] but now the "s" refers to cpu-seconds instead of wall-seconds. A subsequent commit will disambiguate the two types of "s". Issue: GH-32981 --- src/sage/doctest/forker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py index 2ebb3c0b08c..400ed942095 100644 --- a/src/sage/doctest/forker.py +++ b/src/sage/doctest/forker.py @@ -1370,13 +1370,13 @@ def report_success(self, out, test, example, got, *, check_duration=0): sage: FDS = FileDocTestSource(filename, DD) sage: doctests, extras = FDS.create_doctests(globals()) sage: ex = doctests[0].examples[0] - sage: ex.walltime = 0.0 + sage: ex.cputime = 0.0 sage: DTR.report_success(sys.stdout.write, doctests[0], ex, '1764') ok [0.00 s] """ # We completely replace doctest.DocTestRunner.report_success so that we can include time taken for the test if self._verbose: - out("ok [%.2f s]\n" % (example.walltime + check_duration)) + out("ok [%.2f s]\n" % (example.cputime + check_duration)) def report_failure(self, out, test, example, got, globs): r"""