aboutsummaryrefslogtreecommitdiffstats
path: root/testing/runner.py
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2023-10-29 18:25:42 +0100
committerChristian Tismer <tismer@stackless.com>2023-12-07 15:17:37 +0100
commitbc7b78427aca32893cb42c2e84f587dca605c532 (patch)
tree0bf3d99d0fe7f3a52ccb4ecbb7d668a2847347fe /testing/runner.py
parentfa45234cc20ad514e89e7124e2aee9a6347ea474 (diff)
testing: Improve the Python version info to get better control
The QML bug that was identified by "bug_825" revealed a Python error which is persistent in Python 3.8 and was fixed in Python 3.9.12 and Python 3.10.4 . It was not possible to write a work-around without re-implementing large areas of the Python type system. We interrogate the TestRunner to obtain the full Python version. Otherwise we would have to exclude Python 3.8 to 3.10 completely. Task-number: PYSIDE-2230 Change-Id: Ica53c2e7b44cbbf5ec8ca1430ab65e6743beeff8 Pick-to: 6.6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'testing/runner.py')
-rw-r--r--testing/runner.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/runner.py b/testing/runner.py
index 0d3b4c892..b52ac4937 100644
--- a/testing/runner.py
+++ b/testing/runner.py
@@ -36,6 +36,31 @@ class TestRunner(object):
self._setup_clang()
self._setup()
+ def get_python_version(self):
+ """
+ Finding the exact Python version.
+ ---------------------------------
+
+ This is done by asking the interpreter, because it cannot reliably
+ be found from any file name parsing as a triple.
+
+ Note: We need to look into the CMakeCache.txt file to find out
+ what CMake has found as the Python interpreter to use.
+ This is *not* necessarily the same Python that runs this script,
+ otherwise we could use the version info directly.
+ """
+ look_python = os.path.join(self.test_dir, "CMakeCache.txt")
+ look_for = "PYTHON_EXECUTABLE:FILEPATH="
+ with open(look_python) as f:
+ for line in f:
+ if line.startswith(look_for):
+ python_exec = line.split("=")[-1].strip()
+ res = subprocess.run([python_exec, "-c",
+ "import sys;print(sys.version_info[:3])"],
+ capture_output=True)
+ return eval(res.stdout.decode("utf-8"))
+ return None
+
def _setup_clang(self):
if sys.platform != "win32":
return