forked from netromdk/vermin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
executable file
·52 lines (48 loc) · 1.12 KB
/
runtests.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
45
46
47
48
49
50
51
52
#!/usr/bin/env python
import sys
import unittest
from time import time
SUITES = (
"general",
"config",
"arguments",
"lang",
"module",
"builtin_classes",
"class",
"exception",
"builtin_functions",
"builtin_constants",
"function",
"constants",
"decorators",
"kwargs",
"strftime_directive",
"annotation",
"maybe_annotations",
"array_typecodes",
"codecs_error_handlers",
"codecs_encodings",
"exclusions",
"comment_exclusions",
"backports",
"bytes_directive",
"violations",
)
def runsuite(suite):
suite = "tests.{}".format(suite)
print("Running test suite: {}".format(suite))
# Buffer output such that only on test errors will stdout/stderr be shown.
res = unittest.main(suite, exit=False, buffer=True).result
if len(res.failures) > 0 or len(res.errors) > 0:
sys.exit(-1)
return res.testsRun
def execute():
total_tests = 0
for suite in SUITES:
total_tests += runsuite(suite)
return total_tests
if __name__ == '__main__':
start, total_tests = time(), execute()
secs = time() - start
print("Ran {} tests ({} suites) in {:.3f}s".format(total_tests, len(SUITES), secs))