forked from sumerc/yappi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.py
39 lines (31 loc) · 1.05 KB
/
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 sys
def _testsuite_from_tests(tests):
suite = unittest.TestSuite()
loader = unittest.defaultTestLoader
for t in tests:
test = loader.loadTestsFromName('tests.%s' % (t))
suite.addTest(test)
return suite
if __name__ == '__main__':
sys.path.append('tests/')
test_loader = unittest.defaultTestLoader
test_runner = unittest.TextTestRunner(verbosity=2)
tests = [
'test_functionality',
'test_hooks',
'test_tags',
]
if sys.version_info < (3, 10):
tests += ['test_gevent']
if sys.version_info >= (3, 4):
tests += ['test_asyncio']
if sys.version_info >= (3, 7):
tests += ['test_asyncio_context_vars']
test_suite = test_loader.loadTestsFromNames(tests)
if len(sys.argv) > 1:
test_suite = _testsuite_from_tests(sys.argv[1:])
#tests = ['test_functionality.BasicUsage.test_run_as_script']
print("Running following tests: %s" % (tests))
result = test_runner.run(test_suite)
sys.exit(not result.wasSuccessful())