bpo-33718: regrtest: use "xxx then yyy" result if re-run (GH-7521) (GH-7562)
If tests are re-run, use "xxx then yyy" result format (ex: "FAILURE
then SUCCESS") to show that some failing tests have been re-run.
Add also test_regrtest.test_rerun_fail() test.
(cherry picked from commit c45fc7673e23f911639d10d3771ffef7be870c7a)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 97ba2ad..64aa465 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -530,6 +530,7 @@
resource_denieds = []
environment_changed = []
rerun = []
+ first_result = None
interrupted = False
if findleaks:
@@ -907,7 +908,10 @@
if not result:
result.append("SUCCESS")
- return ', '.join(result)
+ result = ', '.join(result)
+ if first_result:
+ result = '%s then %s' % (first_result, result)
+ return result
def display_result():
@@ -974,6 +978,8 @@
display_result()
if verbose2 and bad:
+ first_result = get_tests_result()
+
print
print "Re-running failed tests in verbose mode"
rerun = bad[:]