-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_tests.py
More file actions
26 lines (21 loc) · 759 Bytes
/
Copy pathrun_tests.py
File metadata and controls
26 lines (21 loc) · 759 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
import os
import subprocess
# This is needed to run each test in separate processes as the keras backend cannot be changed while set in a process
def run_test(file):
result = subprocess.run(['pytest', f'tests/test_{backend}.py'], capture_output=True, text=True)
print(f"\n--- {backend.upper()} Backend Test Results ---")
print(result.stdout)
if result.stderr:
print("Errors:")
print(result.stderr)
return result.returncode
if __name__ == "__main__":
backends = ['tensorflow', 'torch', 'jax', 'quick_sig']
exit_codes = []
for backend in backends:
exit_codes.append(run_test(backend))
if any(exit_codes):
exit(1)
else:
print("\nAll tests passed successfully!")
exit(0)