diff options
-rw-r--r-- | python/test/Ice/asyncio/test.py | 9 | ||||
-rw-r--r-- | scripts/Util.py | 11 |
2 files changed, 12 insertions, 8 deletions
diff --git a/python/test/Ice/asyncio/test.py b/python/test/Ice/asyncio/test.py index 8df759f8107..c688472887d 100644 --- a/python/test/Ice/asyncio/test.py +++ b/python/test/Ice/asyncio/test.py @@ -5,13 +5,6 @@ # This test requires asyncio methods which are only available with Python 3.7 -# We want to check the version of the python interpreter used to run the tests -# not the version of the python interpreter running this script see --python option -version = subprocess.check_output([currentConfig.python, - "-c", - "import sys; print(f\"{sys.version_info[0]}.{sys.version_info[1]}\")"], text=True) -version = tuple(int(num) for num in version.split(".")) - -if version >= (3, 7): +if currentConfig.getPythonVersion() >= (3, 7): TestSuite(__name__) diff --git a/scripts/Util.py b/scripts/Util.py index 7497cee2096..92a8427c65f 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -3688,6 +3688,17 @@ class PythonMapping(CppBasedMapping): def __init__(self, options=[]): Mapping.Config.__init__(self, options) + self.pythonVersion = None + + def getPythonVersion(self): + if self.pythonVersion is None: + version = subprocess.check_output( + [currentConfig.python, + "-c", + "import sys; print(\"{0}.{1}\".format(sys.version_info[0], sys.version_info[1]))"], + text=True) + self.pythonVersion = tuple(int(num) for num in version.split(".")) + return self.pythonVersion def getCommandLine(self, current, process, exe, args): return "\"{0}\" {1} {2} {3}".format(current.config.python, |