tests/dbus-runner: Make sure to tear-down even on test failure

When a test failed, an exception would be raised. This meant that the
mocked service would stay alive, and the test case being run eventually
failing due to a timeout, not the failure itself.

Fix this by catching the exception during the test, ensuring that we
tear down properly, then re-raise the same exception again after having
teared down.

This avoids the dead lock, while still printing the appropriate error
message.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2008>
This commit is contained in:
Jonas Ådahl 2021-09-20 13:18:25 +02:00 committed by Marge Bot
parent fca9010963
commit 1031de5605

View File

@ -122,5 +122,7 @@ if __name__ == '__main__':
MutterDBusTestCase.setUpClass()
test_case = MutterDBusTestCase()
test_case.assertGreater(len(sys.argv), 1)
test_case.wrap_call(sys.argv[1:])
MutterDBusTestCase.tearDownClass()
try:
test_case.wrap_call(sys.argv[1:])
finally:
MutterDBusTestCase.tearDownClass()