Pillow/winbuild/test.py

46 lines
1.4 KiB
Python
Raw Permalink Normal View History

2014-04-05 01:57:18 +04:00
#!/usr/bin/env python3
import glob
import os
import subprocess
import sys
2014-04-05 01:57:18 +04:00
from config import VIRT_BASE, X64_EXT, pythons
2014-04-05 01:57:18 +04:00
2015-06-20 06:43:14 +03:00
2014-04-05 01:57:18 +04:00
def test_one(params):
python, architecture = params
try:
2015-06-20 06:43:14 +03:00
print("Running: %s, %s" % params)
2019-06-13 18:54:57 +03:00
command = [
r"{}\{}{}\Scripts\python.exe".format(VIRT_BASE, python, architecture),
2019-06-13 18:54:57 +03:00
"test-installed.py",
"--processes=-0",
"--process-timeout=30",
]
command.extend(glob.glob("Tests/test*.py"))
proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
(trace, stderr) = proc.communicate()
status = proc.returncode
print("Done with {}, {} -- {}".format(python, architecture, status))
2014-04-05 01:57:18 +04:00
return (python, architecture, status, trace)
except Exception as msg:
print("Error with {}, {}: {}".format(python, architecture, msg))
2014-04-05 01:57:18 +04:00
return (python, architecture, -1, str(msg))
2019-06-13 18:54:57 +03:00
if __name__ == "__main__":
2014-04-05 01:57:18 +04:00
2019-06-13 18:54:57 +03:00
os.chdir("..")
matrix = [
(python, architecture) for python in pythons for architecture in ("", X64_EXT)
]
results = map(test_one, matrix)
2014-04-05 01:57:18 +04:00
for (python, architecture, status, trace) in results:
print("{}{}: {}".format(python, architecture, status and "ERR" or "PASS"))
2014-04-05 01:57:18 +04:00
res = all(status for (python, architecture, status, trace) in results)
sys.exit(res)