uitest/test_main.py |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 3dba60b25698ad4c9580a84b6f7588d01de6513d
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Mar 5 08:56:16 2026 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Mar 5 12:41:30 2026 +0100

    Make sure that connection is disposed also on exception
    
    An omission from commit f5d97d14a2169c23b801d5d09ea19c001d36bba1
    (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 <[email protected]>

diff --git a/uitest/test_main.py b/uitest/test_main.py
index 9106d1b8e86a..24e57a683679 100644
--- a/uitest/test_main.py
+++ b/uitest/test_main.py
@@ -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)

Reply via email to