From bd2e2a866ee27a8f8266044415b17e8652ff5af1 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 1 Jul 2024 10:37:36 +0800 Subject: [PATCH] Allow for edge case of app startup. --- testbed/tests/testbed.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testbed/tests/testbed.py b/testbed/tests/testbed.py index 8b6423e068..92ae8efe8c 100644 --- a/testbed/tests/testbed.py +++ b/testbed/tests/testbed.py @@ -15,9 +15,13 @@ def run_tests(app, cov, args, report_coverage, run_slow, running_in_ci): try: - # Wait for the app's main window to be visible. + # Wait for the app's main window to be visible. Retrieving the actual main window + # will raise an exception until the app is actually initialized, so we check the + # underlying variable. print("Waiting for app to be ready for testing... ", end="", flush=True) - while app.main_window is None or not app.main_window.visible: + while app._main_window is app._UNDEFINED: + time.sleep(0.05) + while not app.main_window.visible: time.sleep(0.05) print("ready.") # Control the run speed of the test app.