forked from zlorb/PyModel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrun.py
More file actions
executable file
·32 lines (26 loc) · 792 Bytes
/
trun.py
File metadata and controls
executable file
·32 lines (26 loc) · 792 Bytes
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
#!/usr/bin/env python
import sys
import os
# argv[1] is name of module containing test cases
# dir containing this module must be on PYTHONPATH
if len(sys.argv) != 2:
print('\nUsage: trun <test_cases_module>\n\n')
sys.exit()
try:
test = __import__(sys.argv[1])
except ModuleNotFoundError:
print('\nCould not find tests file "{}".\n\n'.format(sys.argv[1]))
sys.exit()
# Test cases are in 'cases', a list of pairs of strings, descrip. and commmand:
# cases = [
# ('Test PowerOn, PowerOff alternate due to enabling conditions',
# 'pct.py -n 10 PowerSwitch'),
# ... ]
try:
for (description, cmd) in test.cases:
print(description)
os.system(cmd)
print()
except AttributeError:
print('\nCould not find test cases in "{}".\n\n'.format(sys.argv[1]))
sys.exit()