forked from fryfrog/sonarrAnnounced
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_tests.py
executable file
·37 lines (28 loc) · 873 Bytes
/
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
#!/usr/bin/env python3
import argparse
import unittest
import sys
import coverage
sys.path.append("arrnounced/")
cov = coverage.coverage(
branch=True, include="arrnounced/*", omit=["*/__init__.py", "*/config/*"]
)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Run Arrnounced integration tests")
parser.add_argument(
"test", type=str, help="Which tests to run", nargs="?", default="*"
)
try:
args = parser.parse_args()
except Exception as e:
print(e)
sys.exit(1)
cov.start()
suite = unittest.TestLoader().discover(".", pattern="test_{}.py".format(args.test))
result = unittest.TextTestRunner(verbosity=2).run(suite)
cov.stop()
cov.save()
cov.report()
cov.html_report(directory="./coverage")
cov.erase
sys.exit(0 if result.wasSuccessful() else 1)