forked from cameron-woodard/PiPaw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.py
executable file
·44 lines (34 loc) · 894 Bytes
/
manage.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
import os
import sys
import subprocess
TESTS = {
'solenoid': 'solenoid_test',
'rfid': 'RFID_buffer_testing',
'infrared': 'infrared_test',
'encoder': 'encoder_test',
'camera': 'camera_test',
'motor': 'motor_test',
'buzzer': 'buzzer_test'
}
def run_test(part):
module = f"src.tests.{TESTS[part]}"
command = ["python3", "-m", module]
try:
subprocess.run(command, check=True)
except subprocess.CalledProcessError as e:
print(f"Error running {module}: {e}")
def run():
module = "src.main"
command = ["python3", "-m", module]
try:
subprocess.run(command, check=True)
except subprocess.CalledProcessError as e:
print(f"Error running {module}: {e}")
def main():
if sys.argv[1] == "test":
arg = sys.argv[2]
run_test(arg)
if sys.argv[1] == "run":
run()
if __name__ == "__main__":
main()