Pillow/winbuild/test.py

46 lines
1.4 KiB
Python
Raw 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"%s\%s%s\Scripts\python.exe" % (VIRT_BASE, python, architecture),
"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
2015-06-20 06:43:14 +03:00
print("Done with %s, %s -- %s" % (python, architecture, status))
2014-04-05 01:57:18 +04:00
return (python, architecture, status, trace)
except Exception as msg:
2015-06-20 06:43:14 +03:00
print("Error with %s, %s: %s" % (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:
2019-06-13 18:54:57 +03:00
print("%s%s: %s" % (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)