Skip to content

Commit

Permalink
src/sage/doctest/forker.py: report verbose doctest success in CPU time
Browse files Browse the repository at this point in the history
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: sagemathGH-32981
  • Loading branch information
orlitzky committed Apr 16, 2024
1 parent 7efc04c commit 272f6af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sage/doctest/forker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down

0 comments on commit 272f6af

Please sign in to comment.