From 93e7b44824e6ae5f61f848aba17cc0b6c7c9c73a Mon Sep 17 00:00:00 2001 From: Michael Maltsev <4129781+m417z@users.noreply.github.com> Date: Sat, 9 Dec 2023 10:21:46 +0200 Subject: [PATCH] Make tests work on win32 --- test/testall.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/testall.py b/test/testall.py index 92efd1de..38f8d8b8 100644 --- a/test/testall.py +++ b/test/testall.py @@ -23,6 +23,9 @@ def _python_ver_from_python(python): def _gen_python_names(): yield "python" + if sys.platform == "win32": + return + # generate version numbers from python 3.5 to 3.20 for ver in [(3, i) for i in range(5, 20)]: yield "python%d.%d" % ver @@ -33,6 +36,10 @@ def _gen_pythons(): python_from_ver = {} for name in _gen_python_names(): for python in which.whichall(name): + if sys.platform == "win32" and re.search(r"\\WindowsApps\\[^\\]+$", python, flags=re.IGNORECASE): + # skip Python stubs from the Windows Store. + continue + ver = _python_ver_from_python(python) if ver not in python_from_ver: python_from_ver[ver] = python @@ -49,9 +56,11 @@ def testall(): print("-- test with Python %s (%s)" % (ver_str, python)) assert ' ' not in python + env_args = 'MACOSX_DEPLOYMENT_TARGET= ' if sys.platform == 'darwin' else '' + proc = subprocess.Popen( # pass "-u" option to force unbuffered output - "MACOSX_DEPLOYMENT_TARGET= %s -u test.py -- -knownfailure" % python, + "%s%s -u test.py -- -knownfailure" % (env_args, python), shell=True, stderr=subprocess.PIPE ) @@ -64,7 +73,7 @@ def testall(): all_warnings.append((python, ver_str, line)) if proc.returncode: - sys.exit(os.WEXITSTATUS(proc.returncode)) + sys.exit(proc.returncode) for python, ver_str, warning in all_warnings: # now re-print all warnings to make sure they are seen