Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests work on win32 #543

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions test/testall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
)

Expand All @@ -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
Expand Down
Loading