-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun_tests.py
39 lines (30 loc) · 1022 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
38
39
import unittest
import argparse
def unittests():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests/unittests', pattern='*_test.py')
return test_suite
def integrationtests():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests/integrationtests', pattern='*_test.py')
return test_suite
def main():
parser = argparse.ArgumentParser(description = "tests for checkpy")
parser.add_argument("-integration", action="store_true", help="run integration tests")
parser.add_argument("-unit", action="store_true", help="run unittests")
parser.add_argument("-all", action="store_true", help="run all tests")
args = parser.parse_args()
runner = unittest.TextTestRunner(verbosity=1, buffer=True)
if args.all:
runner.run(unittests())
runner.run(integrationtests())
return
if args.unit:
runner.run(unittests())
return
if args.integration:
runner.run(integrationtests())
return
parser.print_help()
if __name__ == "__main__":
main()