-
Notifications
You must be signed in to change notification settings - Fork 4
/
testrunner.py
64 lines (53 loc) · 1.5 KB
/
testrunner.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
57
58
59
60
61
62
63
64
import glob
import subprocess
import sys
"""
when running this locally use:
python testrunner.py "PATH/TO/YOUR/BLENDER/EXECUTABLE"
so, e.g., under Windows it will likely be
python testrunner.py "C:\Program Files\Blender Foundation\Blender 3.3\blender"
"""
blenderExecutable = "blender"
# testrunner structure built based on https://github.com/dfki-ric/phobos
# allow override of blender executable (important for TravisCI!)
if len(sys.argv) > 1:
blenderExecutable = sys.argv[1]
# run all tests before aborting build
testfailed = False
failed_tests = []
# iterate over each *.test.py file in the "tests" directory
for file in glob.glob("tests/*.test.py"):
print("#" * 100)
print("Running {} tests...".format(file))
print("#" * 100)
code = subprocess.call(
[
blenderExecutable,
"--addons",
"omni_trax",
"--factory-startup",
"-noaudio",
"--background",
"--python",
file,
"--python-exit-code",
"1",
]
)
print("#" * 100)
print("Exited with: ", code)
print("#" * 100 + "\n\n\n")
if code:
testfailed = True
failed_tests.append(file)
for test in failed_tests:
print("#" * 100, "\n")
print("FAILED: {}".format(test))
print("See stderr above for details!".format())
print("\n", "#" * 100 + "\n\n\n")
if testfailed:
sys.exit(1)
else:
print("#" * 100)
print("--- ALL TESTS PASSED ---")
print("#" * 100 + "\n")