@@ -15,13 +15,6 @@ def __init__(self, config: Config, cli_args: CLIArgs):
15
15
self .cli_args : CLIArgs = cli_args
16
16
self .failures : List [TestResult ] = []
17
17
18
- def post_run_log (self ):
19
- """Report failures to stdout."""
20
- if self .failures != []:
21
- log (f"Failure Summary: ({ len (self .failures )} tests)" )
22
- for result in self .failures :
23
- result .log ()
24
-
25
18
def process_test_result (self , test_result : Optional [TestResult ], counters : Dict [str , int ]):
26
19
"""
27
20
Process each test result.
@@ -43,7 +36,10 @@ def pre_executable_hook(self):
43
36
44
37
def post_executable_hook (self ):
45
38
"""Hook to run after iterating through an executable"""
46
- pass
39
+ if self .failures != []:
40
+ log (f"Failure Summary: ({ len (self .failures )} tests)" )
41
+ for result in self .failures :
42
+ result .log ()
47
43
48
44
def iterate (self ):
49
45
"""
@@ -70,7 +66,7 @@ def iterate(self):
70
66
counters = {"pass_count" : 0 , "test_count" : 0 }
71
67
self .pre_subpackage_hook (spkg )
72
68
for test in spkg .tests :
73
- test_result : Optional [ TestResult ] = tc_runner .run (test , exe )
69
+ test_result : TestResult = tc_runner .run (test , exe )
74
70
self .process_test_result (test_result , counters )
75
71
self .post_subpackage_hook (counters )
76
72
log ("Subpackage Passed: " , counters ["pass_count" ], "/" , counters ["test_count" ], indent = 3 )
@@ -100,9 +96,7 @@ def process_test_result(self, test_result: Optional[TestResult], counters: Dict[
100
96
"""
101
97
Override the hook for regular run-specific implementation of counting passes
102
98
"""
103
- if not test_result :
104
- log ("[ERROR] Failed to receive test result" , indent = 7 )
105
- elif test_result .did_pass :
99
+ if test_result .did_pass :
106
100
counters ["pass_count" ] += 1
107
101
test_result .log (args = self .cli_args )
108
102
else :
@@ -126,10 +120,7 @@ def process_test_result(self,
126
120
toolchain_name = context ["toolchain_name" ]
127
121
a_pkg_name = context ["a_pkg_name" ]
128
122
129
- if not test_result :
130
- log (f"Failed to run test { test .stem } " )
131
- context ["exit_status" ] = False
132
- elif test_result .did_pass :
123
+ if test_result .did_pass :
133
124
print (Fore .GREEN + '.' + Fore .RESET , end = '' )
134
125
counters ['pass_count' ] += 1
135
126
else :
@@ -251,6 +242,11 @@ def post_executable_hook(self):
251
242
indent = 4 )
252
243
self .leak_tests = []
253
244
self .test_count = 0 # reset for each executable
245
+
246
+ if self .failures != []:
247
+ log (f"Failure Summary: ({ len (self .failures )} tests)" )
248
+ for result in self .failures :
249
+ result .log ()
254
250
255
251
def process_test_result (self , test_result : Optional [TestResult ], counters : Dict [str , int ]):
256
252
"""
@@ -286,9 +282,7 @@ def process_test_result(self, test_result: Optional[TestResult], counters: Dict[
286
282
"""
287
283
Override the hook for regular run-specific implementation of counting passes
288
284
"""
289
- if not test_result :
290
- log ("Failed to receive test result" )
291
- elif test_result .did_pass :
285
+ if test_result .did_pass :
292
286
counters ["pass_count" ] += 1
293
287
test_result .log (args = self .cli_args )
294
288
else :
0 commit comments