summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-10-11 08:37:25 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-10-11 08:37:25 (GMT)
commit3909e58994f929abacc20e1f32b63e30109f942b (patch)
treeb5bc8cf52ff4f16f691ce2cfc1ee947a8c9e1e04 /Lib/test/libregrtest
parent00a09c05ed5c2324fe94fc1f51fce748869ca935 (diff)
downloadcpython-3909e58994f929abacc20e1f32b63e30109f942b.zip
cpython-3909e58994f929abacc20e1f32b63e30109f942b.tar.gz
cpython-3909e58994f929abacc20e1f32b63e30109f942b.tar.bz2
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
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r--Lib/test/libregrtest/main.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index aa95b21..82788ad 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -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()