summaryrefslogtreecommitdiffstats
path: root/util/testrunner/qt-testrunner.py
diff options
context:
space:
mode:
authorDimitrios Apostolou <[email protected]>2025-10-18 03:01:16 +0200
committerDimitrios Apostolou <[email protected]>2025-12-12 00:11:08 +0100
commit79a34b923351ac36252618c43b9f614cfa2e86f2 (patch)
tree9fc804a11506be3e26abc64bf979d7a85d9c3523 /util/testrunner/qt-testrunner.py
parentc6aa0ac70fe6c37ec7dcaa8df1a892580b43cac6 (diff)
qt_testrunner: fix execution of qt_mock_test.py under testing on windows
tst_qt_testrunner.py invokes qt_testrunner.py which invokes qt_mock_test.py. On Windows a python script is not directly executable. It needs to be executed as "python.exe script.py". To achieve that when testing, the tests set the env var QT_TESTRUNNER_TESTING. When qt-testrunner detects that, it prepends the command line with sys.executable which is the currently used python interpreter. Doing so also ensures that all sub-scripts are executed with the same Python version. Pick-to: 6.11 6.10 6.8 Change-Id: I4786e4015ded328077fd9cc7b443f4b4d9d69de7 Reviewed-by: MÃ¥rten Nordheim <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
Diffstat (limited to 'util/testrunner/qt-testrunner.py')
-rwxr-xr-xutil/testrunner/qt-testrunner.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/testrunner/qt-testrunner.py b/util/testrunner/qt-testrunner.py
index 6437c3fe7f1..52d11dfeee6 100755
--- a/util/testrunner/qt-testrunner.py
+++ b/util/testrunner/qt-testrunner.py
@@ -299,6 +299,12 @@ def parse_log(results_file) -> WhatFailed:
def run_test(arg_list: List[str], **kwargs):
+ if (os.environ.get("QT_TESTRUNNER_TESTING", "0") == "1"
+ and os.name == "nt"
+ and arg_list[0].endswith(".py")
+ ):
+ # For executing qt_mock_test.py under the same Python interpreter when testing.
+ arg_list = [ sys.executable ] + arg_list
L.debug("Running test command line: %s", arg_list)
proc = subprocess.run(arg_list, **kwargs)
L.info("Test process exited with code: %d", proc.returncode)