-
Notifications
You must be signed in to change notification settings - Fork 252
/
run_tests.py
56 lines (41 loc) · 1.13 KB
/
run_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import sys
import contextlib
import subprocess
@contextlib.contextmanager
def binding(binding):
"""Prepare an environment for a specific binding"""
sys.stderr.write("""\
#
# Running tests with %s..
#
""" % binding)
os.environ["QT_PREFERRED_BINDING"] = binding
try:
yield
except:
pass
os.environ.pop("QT_PREFERRED_BINDING")
if __name__ == "__main__":
argv = [
os.environ.get('NOSETESTS_BINARY'),
"--verbose",
"--with-process-isolation",
"--exe",
]
errors = 0
# Running each test independently via subprocess
# enables tests to filter out from tests.py before
# being split into individual processes via the
# --with-process-isolation feature of nose.
with binding("PyQt4"):
errors += subprocess.call(argv)
if sys.version_info <= (3, 4):
with binding("PySide"):
errors += subprocess.call(argv)
with binding("PyQt5"):
errors += subprocess.call(argv)
with binding("PySide2"):
errors += subprocess.call(argv)
if errors:
raise Exception("%i binding(s) failed." % errors)