Cleanly catch keyboard interrupts during tests
When running the inventory tests on a development machine, using ctrl-c to send sigint should gracefully finish the current test and clean up the workspace (tests/inventory). While most of our tests are well-behaved, without the catchbreak=True option, sometimes the code would be interrupted in between file creation and cleanup. Additionally, tearDownModule was never called, leaving behind inventory/openstack_user_config.yml This change allows the current test to finish, it's teardown methods to run, and finally the tearDownModule function to execute, leaving behind a clean workspace. Only the tests that directly touch the filesystem were changed. While this is not impactful for gate tests, it improves quality of life for developers. Change-Id: I992e514e58958264d90faab7bc295d6d8e89f039
This commit is contained in:
parent
16f0609040
commit
f0e6184185
@ -102,4 +102,4 @@ class TestMultipleRuns(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
unittest.main(catchbreak=True)
|
||||
|
@ -1400,4 +1400,4 @@ class TestInventoryGroupConstraints(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
unittest.main(catchbreak=True)
|
||||
|
@ -127,4 +127,4 @@ class TestRemoveIpfunction(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
unittest.main(catchbreak=True)
|
||||
|
Loading…
Reference in New Issue
Block a user