@@ -58,6 +58,11 @@ def runall(self, checks, sort=False, *args, **kwargs):
5858
5959 self .runner .runall (cases )
6060
61+ def assertRunall (self ):
62+ # Make sure that all cases finished or failed
63+ for t in self .runner .stats .tasks ():
64+ assert t .succeeded or t .failed
65+
6166 def _num_failures_stage (self , stage ):
6267 stats = self .runner .stats
6368 return len ([t for t in stats .failures () if t .failed_stage == stage ])
@@ -77,6 +82,7 @@ def test_runall(self):
7782
7883 stats = self .runner .stats
7984 self .assertEqual (7 , stats .num_cases ())
85+ self .assertRunall ()
8086 self .assertEqual (4 , len (stats .failures ()))
8187 self .assertEqual (2 , self ._num_failures_stage ('setup' ))
8288 self .assertEqual (1 , self ._num_failures_stage ('sanity' ))
@@ -87,6 +93,7 @@ def test_runall_skip_system_check(self):
8793
8894 stats = self .runner .stats
8995 self .assertEqual (8 , stats .num_cases ())
96+ self .assertRunall ()
9097 self .assertEqual (4 , len (stats .failures ()))
9198 self .assertEqual (2 , self ._num_failures_stage ('setup' ))
9299 self .assertEqual (1 , self ._num_failures_stage ('sanity' ))
@@ -97,6 +104,7 @@ def test_runall_skip_prgenv_check(self):
97104
98105 stats = self .runner .stats
99106 self .assertEqual (8 , stats .num_cases ())
107+ self .assertRunall ()
100108 self .assertEqual (4 , len (stats .failures ()))
101109 self .assertEqual (2 , self ._num_failures_stage ('setup' ))
102110 self .assertEqual (1 , self ._num_failures_stage ('sanity' ))
@@ -108,6 +116,7 @@ def test_runall_skip_sanity_check(self):
108116
109117 stats = self .runner .stats
110118 self .assertEqual (7 , stats .num_cases ())
119+ self .assertRunall ()
111120 self .assertEqual (3 , len (stats .failures ()))
112121 self .assertEqual (2 , self ._num_failures_stage ('setup' ))
113122 self .assertEqual (0 , self ._num_failures_stage ('sanity' ))
@@ -119,6 +128,7 @@ def test_runall_skip_performance_check(self):
119128
120129 stats = self .runner .stats
121130 self .assertEqual (7 , stats .num_cases ())
131+ self .assertRunall ()
122132 self .assertEqual (3 , len (stats .failures ()))
123133 self .assertEqual (2 , self ._num_failures_stage ('setup' ))
124134 self .assertEqual (1 , self ._num_failures_stage ('sanity' ))
@@ -130,6 +140,7 @@ def test_strict_performance_check(self):
130140
131141 stats = self .runner .stats
132142 self .assertEqual (7 , stats .num_cases ())
143+ self .assertRunall ()
133144 self .assertEqual (5 , len (stats .failures ()))
134145 self .assertEqual (2 , self ._num_failures_stage ('setup' ))
135146 self .assertEqual (1 , self ._num_failures_stage ('sanity' ))
@@ -138,6 +149,7 @@ def test_strict_performance_check(self):
138149 def test_force_local_execution (self ):
139150 self .runner .policy .force_local = True
140151 self .runall ([HelloTest ()])
152+ self .assertRunall ()
141153 stats = self .runner .stats
142154 for t in stats .tasks ():
143155 self .assertTrue (t .check .local )
@@ -165,6 +177,7 @@ def test_retries_bad_check(self):
165177
166178 # Ensure that the test was retried #max_retries times and failed.
167179 self .assertEqual (2 , self .runner .stats .num_cases ())
180+ self .assertRunall ()
168181 self .assertEqual (max_retries , rt .runtime ().current_run )
169182 self .assertEqual (2 , len (self .runner .stats .failures ()))
170183
@@ -179,6 +192,7 @@ def test_retries_good_check(self):
179192
180193 # Ensure that the test passed without retries.
181194 self .assertEqual (1 , self .runner .stats .num_cases ())
195+ self .assertRunall ()
182196 self .assertEqual (0 , rt .runtime ().current_run )
183197 self .assertEqual (0 , len (self .runner .stats .failures ()))
184198
@@ -196,6 +210,7 @@ def test_pass_in_retries(self):
196210
197211 # Ensure that the test passed after retries in run #run_to_pass.
198212 self .assertEqual (1 , self .runner .stats .num_cases ())
213+ self .assertRunall ()
199214 self .assertEqual (1 , len (self .runner .stats .failures (run = 0 )))
200215 self .assertEqual (run_to_pass , rt .runtime ().current_run )
201216 self .assertEqual (0 , len (self .runner .stats .failures ()))
@@ -210,13 +225,14 @@ def test_dependencies(self):
210225 self .checks = self .loader .load_all ()
211226 self .runall (self .checks , sort = True )
212227
228+ self .assertRunall ()
213229 stats = self .runner .stats
214- assert stats .num_cases (0 ) == 8
215- assert len (stats .failures ()) == 2
230+ assert stats .num_cases (0 ) == 10
231+ assert len (stats .failures ()) == 4
216232 for tf in stats .failures ():
217233 check = tf .testcase .check
218- exc_type , exc_value , _ = tf .exc_info
219- if check .name == 'T7' :
234+ _ , exc_value , _ = tf .exc_info
235+ if check .name == 'T7' or check . name == 'T9' :
220236 assert isinstance (exc_value , TaskDependencyError )
221237
222238 # Check that cleanup is executed properly for successful tests as well
@@ -309,6 +325,7 @@ def test_concurrency_unlimited(self):
309325
310326 # Ensure that all tests were run and without failures.
311327 self .assertEqual (len (checks ), self .runner .stats .num_cases ())
328+ self .assertRunall ()
312329 self .assertEqual (0 , len (self .runner .stats .failures ()))
313330
314331 # Ensure that maximum concurrency was reached as fast as possible
@@ -334,6 +351,7 @@ def test_concurrency_limited(self):
334351
335352 # Ensure that all tests were run and without failures.
336353 self .assertEqual (len (checks ), self .runner .stats .num_cases ())
354+ self .assertRunall ()
337355 self .assertEqual (0 , len (self .runner .stats .failures ()))
338356
339357 # Ensure that maximum concurrency was reached as fast as possible
@@ -372,6 +390,7 @@ def test_concurrency_none(self):
372390
373391 # Ensure that all tests were run and without failures.
374392 self .assertEqual (len (checks ), self .runner .stats .num_cases ())
393+ self .assertRunall ()
375394 self .assertEqual (0 , len (self .runner .stats .failures ()))
376395
377396 # Ensure that a single task was running all the time
@@ -391,6 +410,7 @@ def _run_checks(self, checks, max_jobs):
391410 self .assertRaises (KeyboardInterrupt , self .runall , checks )
392411
393412 self .assertEqual (4 , self .runner .stats .num_cases ())
413+ self .assertRunall ()
394414 self .assertEqual (4 , len (self .runner .stats .failures ()))
395415 self .assert_all_dead ()
396416
@@ -427,6 +447,7 @@ def test_poll_fails_main_loop(self):
427447 self .runall (checks )
428448 stats = self .runner .stats
429449 self .assertEqual (num_tasks , stats .num_cases ())
450+ self .assertRunall ()
430451 self .assertEqual (num_tasks , len (stats .failures ()))
431452
432453 def test_poll_fails_busy_loop (self ):
@@ -437,6 +458,7 @@ def test_poll_fails_busy_loop(self):
437458 self .runall (checks )
438459 stats = self .runner .stats
439460 self .assertEqual (num_tasks , stats .num_cases ())
461+ self .assertRunall ()
440462 self .assertEqual (num_tasks , len (stats .failures ()))
441463
442464
0 commit comments