Make sure that connection is disposed also on exception
An omission from commit f5d97d14a2
(uitest: add a way to optionally use the same soffice process for
a testsuite, 2023-03-20).
When testing locally, on some exceptions, soffice process was left
running, and following attempts to run the test failed because of
that.
Change-Id: I3f24c7756020835182dc53565e0be7660ee9f040
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201003
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
+10
-8
@@ -135,14 +135,16 @@ if __name__ == '__main__':
|
||||
usage()
|
||||
sys.exit()
|
||||
|
||||
result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(test_suite)
|
||||
print("Tests run: %d" % result.testsRun)
|
||||
print("Tests failed: %d" % len(result.failures))
|
||||
print("Tests errors: %d" % len(result.errors))
|
||||
print("Tests skipped: %d" % len(result.skipped))
|
||||
if connection:
|
||||
connection.tearDown()
|
||||
connection.kill()
|
||||
try:
|
||||
result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(test_suite)
|
||||
print("Tests run: %d" % result.testsRun)
|
||||
print("Tests failed: %d" % len(result.failures))
|
||||
print("Tests errors: %d" % len(result.errors))
|
||||
print("Tests skipped: %d" % len(result.skipped))
|
||||
finally:
|
||||
if connection:
|
||||
connection.tearDown()
|
||||
connection.kill()
|
||||
if not result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
sys.exit(0)
|
||||
|
||||
Reference in New Issue
Block a user