mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
regrtest: display test result (passed, failed, ...)
* in multiprocessing mode: always display the result * sequential mode: only display the result if the test did not pass
This commit is contained in:
parent
6d81a2136d
commit
1b8b42344e
3 changed files with 26 additions and 8 deletions
|
@ -15,7 +15,7 @@ from test.libregrtest.runtest import (
|
|||
findtests, runtest,
|
||||
STDTESTS, NOTTESTS, PASSED, FAILED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED,
|
||||
INTERRUPTED, CHILD_ERROR,
|
||||
PROGRESS_MIN_TIME)
|
||||
PROGRESS_MIN_TIME, format_test_result)
|
||||
from test.libregrtest.setup import setup_tests
|
||||
from test import support
|
||||
try:
|
||||
|
@ -326,7 +326,9 @@ class Regrtest:
|
|||
# if on a false return value from main.
|
||||
cmd = ('result = runtest(self.ns, test); '
|
||||
'self.accumulate_result(test, result)')
|
||||
self.tracer.runctx(cmd, globals=globals(), locals=vars())
|
||||
ns = dict(locals())
|
||||
self.tracer.runctx(cmd, globals=globals(), locals=ns)
|
||||
result = ns['result']
|
||||
else:
|
||||
try:
|
||||
result = runtest(self.ns, test)
|
||||
|
@ -337,10 +339,12 @@ class Regrtest:
|
|||
else:
|
||||
self.accumulate_result(test, result)
|
||||
|
||||
previous_test = format_test_result(test, result[0])
|
||||
test_time = time.monotonic() - start_time
|
||||
if test_time >= PROGRESS_MIN_TIME:
|
||||
previous_test = '%s took %.0f sec' % (test, test_time)
|
||||
else:
|
||||
previous_test = "%s in %.0f sec" % (previous_test, test_time)
|
||||
elif result[0] == PASSED:
|
||||
# be quiet: say nothing if the test passed shortly
|
||||
previous_test = None
|
||||
|
||||
if self.ns.findleaks:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue