-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_tests.py
46 lines (34 loc) · 1.04 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
40
41
42
43
44
45
#!/usr/bin/env python3
"""Custom test harness for shtk"""
import os
import unittest
import coverage
import pathlib
def main():
testsdir = pathlib.Path('./shtk/test').resolve()
packagedir = testsdir.parent
covdir = pathlib.Path("./coverage").resolve()
covdir.mkdir(exist_ok=True)
covhtml = covdir / "html"
covhtml.mkdir(exist_ok=True)
covdata = covdir / "datafile"
print((packagedir / "*").resolve())
print((testsdir / "*").resolve())
cov = coverage.Coverage(
data_file = str(covdata.resolve()),
include = str((packagedir / "*").resolve()),
omit = str((testsdir / "*").resolve()),
config_file = str((testsdir / "coveragerc").resolve())
)
cov.start()
suite = unittest.TestSuite()
import shtk
from shtk.test.test_util import test_registry
for test in test_registry['all']:
suite.addTest(test())
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite)
cov.stop()
cov.save()
cov.html_report(directory=str(covhtml))
main()