-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_tests.py
28 lines (25 loc) · 1010 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
#!/usr/bin/env python
# coding:utf-8
# Author: ASU --<[email protected]>
# Purpose:
# Created: 11/5/2017
import os
import sys
import unittest
import io
__author__ = 'ASU'
if __name__ == '__main__':
testLoader = unittest.TestLoader()
pymajorVersion = sys.version_info[0]
packageDir = os.path.join(os.path.dirname(__file__), "py%d" % pymajorVersion, "pyxtension")
testsDir = os.path.join(packageDir, "tests")
#sys.path.append(packageDir)
# textTestResult = unittest.TextTestResult(io.StringIO(),'',verbosity=1)
trunner = unittest.TextTestRunner(sys.stdout, descriptions=True, verbosity=0)
testSuite = testLoader.discover(start_dir=testsDir, pattern="test_*.py", top_level_dir=testsDir)
res = trunner.run(testSuite)
testSuite = testLoader.discover(start_dir=testsDir, pattern="test_*.py", top_level_dir=testsDir)
testResult = unittest.TestResult()
res = testSuite.run(testResult)
assert not res.errors, "Unittests error: %s" % res.errors
print(res)