Python test famework should log only relevant exception and exit with a non-zero code on error. #6157

This commit is contained in:
Aditya Toshniwal
2023-04-20 13:27:12 +05:30
parent d6ecc531e0
commit 7e2add8db1
2 changed files with 71 additions and 76 deletions

View File

@@ -477,6 +477,7 @@ def execute_test(test_module_list_passed, server_passed, driver_passed,
:param parallel_ui_test: parallel ui tests
:return:
"""
server_information = None
try:
print("\n=============Running the test cases for '%s' ============="
% server_passed['name'], file=sys.stderr)
@@ -568,12 +569,13 @@ def execute_test(test_module_list_passed, server_passed, driver_passed,
threading.current_thread().ident,
threading.current_thread().name))
# Mark failure as true
if str(exc).find('other sessions using the database.') != -1:
if 'other sessions using the database.' not in str(exc):
global failure
failure = True
finally:
# Delete test server
test_utils.delete_server(test_client, server_information)
if server_information:
test_utils.delete_server(test_client, server_information)
# Delete web-driver instance
thread_name = "parallel_tests" + server_passed['name']
if threading.current_thread().name == thread_name: