Fixed an issue where a long time is taken to launch pgAdmin in debug mode for feature tests.

This commit is contained in:
Yogesh Mahajan 2021-04-14 11:56:38 +05:30 committed by Akshay Joshi
parent f07463024c
commit 4ee40e348c
2 changed files with 33 additions and 18 deletions

View File

@ -1332,8 +1332,9 @@ def launch_url_in_browser(driver_instance, url, title='pgAdmin 4', timeout=50):
if count == 0:
print(str(e))
exception_msg = 'Web-page title did not match to {0}. ' \
'Please check url {1} accessible on ' \
'internet.'.format(title, url)
'Waited for {1} seconds Please check url {2}' \
' accessible on internet.'.\
format(title, timeout, url)
raise WebDriverException(exception_msg)

View File

@ -570,12 +570,12 @@ def run_parallel_tests(url_client, servers_details, parallel_tests_lists,
:param max_thread_count:
"""
driver_object = None
try:
# Thread list
threads_list = []
# Create thread for each server
for ser in servers_details:
# Logic to add new threads
try:
while True:
# If active thread count <= max_thread_count, add new thread
if threading.activeCount() <= max_thread_count:
@ -606,10 +606,18 @@ def run_parallel_tests(url_client, servers_details, parallel_tests_lists,
# Start threads in parallel
for t in threads_list:
t.join()
except Exception as exc:
# Print exception stack trace
traceback.print_exc(file=sys.stderr)
print(str(exc))
print('Exception before starting tests for ' + ser['name'],
file=sys.stderr)
print(str(exc), file=sys.stderr)
# Mark failure as true
global failure
failure = True
# Clean driver object created
if driver_object is not None:
driver_object.quit()
@ -816,6 +824,12 @@ if __name__ == '__main__':
app_starter_local = AppStarter(None, config)
client_url = app_starter_local.start_app()
if config.DEBUG:
print('pgAdmin is launched with DEBUG=True, '
'hence sleeping for 50 seconds.',
file=sys.stderr)
time.sleep(50)
# Running Parallel tests
if len(parallel_tests) > 0:
parallel_sessions = \