mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Close #25373: Fix regrtest --slow with interrupted test
* Fix accumulate_result(): don't use time on interrupted and failed test * Add unit test for interrupted test * Add unit test on --slow with interrupted test, with and without multiprocessing
This commit is contained in:
parent
00a09c05ed
commit
3909e58994
2 changed files with 49 additions and 6 deletions
|
@ -7,10 +7,11 @@ import sys
|
|||
import sysconfig
|
||||
import tempfile
|
||||
import textwrap
|
||||
from test.libregrtest.cmdline import _parse_args
|
||||
from test.libregrtest.runtest import (
|
||||
findtests, runtest,
|
||||
STDTESTS, NOTTESTS, PASSED, FAILED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED)
|
||||
from test.libregrtest.cmdline import _parse_args
|
||||
STDTESTS, NOTTESTS, PASSED, FAILED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED,
|
||||
INTERRUPTED, CHILD_ERROR)
|
||||
from test.libregrtest.setup import setup_tests
|
||||
from test import support
|
||||
try:
|
||||
|
@ -87,7 +88,8 @@ class Regrtest:
|
|||
|
||||
def accumulate_result(self, test, result):
|
||||
ok, test_time = result
|
||||
self.test_times.append((test_time, test))
|
||||
if ok not in (CHILD_ERROR, INTERRUPTED):
|
||||
self.test_times.append((test_time, test))
|
||||
if ok == PASSED:
|
||||
self.good.append(test)
|
||||
elif ok == FAILED:
|
||||
|
@ -291,10 +293,12 @@ class Regrtest:
|
|||
else:
|
||||
try:
|
||||
result = runtest(self.ns, test)
|
||||
self.accumulate_result(test, result)
|
||||
except KeyboardInterrupt:
|
||||
self.accumulate_result(test, (INTERRUPTED, None))
|
||||
self.interrupted = True
|
||||
break
|
||||
else:
|
||||
self.accumulate_result(test, result)
|
||||
|
||||
if self.ns.findleaks:
|
||||
gc.collect()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue