@@ -329,22 +329,34 @@ def test_depends_on_huge():
329
329
330
330
def test_depends_on_error_not_running ():
331
331
runner = Tests .setup_runner (usage_scenario = 'depends_on_error_not_running.yml' , dry_run = True )
332
- with pytest .raises (RuntimeError ) as e :
333
- Tests .run_until (runner , 'setup_services' )
332
+ try :
333
+ with pytest .raises (RuntimeError ) as e :
334
+ Tests .run_until (runner , 'setup_services' )
335
+ finally :
336
+ runner .cleanup ()
337
+
334
338
assert "Dependent container 'test-container-2' of 'test-container-1' is not running" in str (e .value ) , \
335
339
Tests .assertion_info ('test-container-2 is not running' , str (e .value ))
336
340
337
341
def test_depends_on_error_cyclic_dependency ():
338
342
runner = Tests .setup_runner (usage_scenario = 'depends_on_error_cycle.yml' , dry_run = True )
339
- with pytest .raises (RuntimeError ) as e :
340
- Tests .run_until (runner , 'setup_services' )
343
+ try :
344
+ with pytest .raises (RuntimeError ) as e :
345
+ Tests .run_until (runner , 'setup_services' )
346
+ finally :
347
+ runner .cleanup ()
348
+
341
349
assert "Cycle found in depends_on definition with service 'test-container-1'" in str (e .value ) , \
342
350
Tests .assertion_info ('cycle in depends_on with test-container-1' , str (e .value ))
343
351
344
352
def test_depends_on_error_unsupported_long_form ():
345
353
runner = Tests .setup_runner (usage_scenario = 'depends_on_error_unsupported_long_form.yml' , dry_run = True )
346
- with pytest .raises (RuntimeError ) as e :
347
- Tests .run_until (runner , 'setup_services' )
354
+ try :
355
+ with pytest .raises (RuntimeError ) as e :
356
+ Tests .run_until (runner , 'setup_services' )
357
+ finally :
358
+ runner .cleanup ()
359
+
348
360
assert "long form" in str (e .value ) , \
349
361
Tests .assertion_info ('long form is not supported' , str (e .value ))
350
362
@@ -454,9 +466,12 @@ def test_uri_local_dir():
454
466
455
467
def test_uri_local_dir_missing ():
456
468
runner = Tests .setup_runner (usage_scenario = 'basic_stress.yml' , uri = '/tmp/missing' )
457
- with pytest .raises (FileNotFoundError ) as e :
458
- runner .run ()
459
- expected_exception = 'No such file or directory: \' /tmp/missing\' '
469
+ try :
470
+ with pytest .raises (FileNotFoundError ) as e :
471
+ runner .run ()
472
+ expected_exception = 'No such file or directory: \' /tmp/missing\' '
473
+ finally :
474
+ runner .cleanup ()
460
475
assert expected_exception in str (e .value ),\
461
476
Tests .assertion_info (f"Exception: { expected_exception } " , str (e .value ))
462
477
0 commit comments