bpo-36719: regrtest -jN no longer stops on crash (GH-13231)
"python3 -m test -jN ..." now continues the execution of next tests
when a worker process crash (CHILD_ERROR state). Previously, the test
suite stopped immediately. Use --failfast to stop at the first error.
Moreover, --forever now also implies --failfast.
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index c19ea44..02717d8c 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -16,7 +16,7 @@
findtests, runtest, get_abs_module,
STDTESTS, NOTTESTS, PASSED, FAILED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED,
INTERRUPTED, CHILD_ERROR, TEST_DID_NOT_RUN,
- PROGRESS_MIN_TIME, format_test_result)
+ PROGRESS_MIN_TIME, format_test_result, is_failed)
from test.libregrtest.setup import setup_tests
from test.libregrtest.utils import removepy, count, format_duration, printlist
from test import support
@@ -404,7 +404,7 @@
test_time = time.monotonic() - start_time
if test_time >= PROGRESS_MIN_TIME:
previous_test = "%s in %s" % (previous_test, format_duration(test_time))
- elif result[0] == PASSED:
+ elif result.result == PASSED:
# be quiet: say nothing if the test passed shortly
previous_test = None
@@ -413,6 +413,9 @@
if module not in save_modules and module.startswith("test."):
support.unload(module)
+ if self.ns.failfast and is_failed(result, self.ns):
+ break
+
if previous_test:
print(previous_test)