@@ -103,17 +103,18 @@ def get_executed(self):
103103 | set (self .resource_denieds ) | set (self .environment_changed )
104104 | set (self .run_no_tests ))
105105
106- def accumulate_result (self , result ):
106+ def accumulate_result (self , result , rerun = False ):
107107 test_name = result .test_name
108108 ok = result .result
109109
110- if ok not in (CHILD_ERROR , INTERRUPTED ):
110+ if ok not in (CHILD_ERROR , INTERRUPTED ) and not rerun :
111111 self .test_times .append ((result .test_time , test_name ))
112112
113113 if ok == PASSED :
114114 self .good .append (test_name )
115115 elif ok in (FAILED , CHILD_ERROR ):
116- self .bad .append (test_name )
116+ if not rerun :
117+ self .bad .append (test_name )
117118 elif ok == ENV_CHANGED :
118119 self .environment_changed .append (test_name )
119120 elif ok == SKIPPED :
@@ -123,9 +124,14 @@ def accumulate_result(self, result):
123124 self .resource_denieds .append (test_name )
124125 elif ok == TEST_DID_NOT_RUN :
125126 self .run_no_tests .append (test_name )
126- elif ok != INTERRUPTED :
127+ elif ok == INTERRUPTED :
128+ self .interrupted = True
129+ else :
127130 raise ValueError ("invalid test result: %r" % ok )
128131
132+ if rerun and ok not in {FAILED , CHILD_ERROR , INTERRUPTED }:
133+ self .bad .remove (test_name )
134+
129135 xml_data = result .xml_data
130136 if xml_data :
131137 import xml .etree .ElementTree as ET
@@ -287,13 +293,11 @@ def rerun_failed_tests(self):
287293 for test_name in self .rerun :
288294 print (f"Re-running { test_name } in verbose mode" , flush = True )
289295 self .ns .verbose = True
290- ok = runtest (self .ns , test_name )
296+ result = runtest (self .ns , test_name )
291297
292- if ok [0 ] in {PASSED , ENV_CHANGED , SKIPPED , RESOURCE_DENIED }:
293- self .bad .remove (test_name )
298+ self .accumulate_result (result , rerun = True )
294299
295- if ok .result == INTERRUPTED :
296- self .interrupted = True
300+ if result .result == INTERRUPTED :
297301 break
298302
299303 if self .bad :
@@ -392,7 +396,6 @@ def run_tests_sequential(self):
392396 self .accumulate_result (result )
393397
394398 if result .result == INTERRUPTED :
395- self .interrupted = True
396399 break
397400
398401 previous_test = format_test_result (result )
0 commit comments