-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest.py
More file actions
39 lines (29 loc) · 964 Bytes
/
test.py
File metadata and controls
39 lines (29 loc) · 964 Bytes
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 os
import sys
bin_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "app", "bin"))
if bin_path not in sys.path:
sys.path.insert(0, bin_path)
lib_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "app", "lib"))
if lib_path not in sys.path:
sys.path.insert(0, lib_path)
import unittest
import inspect
from dltk.test.cases import *
def new_id(self) -> str:
return "test.dltk." + self.__class__.__name__
test_types = []
for name in dir():
t = getattr(sys.modules[__name__], name)
if inspect.isclass(t):
if issubclass(t, unittest.TestCase):
t.id = new_id
test_types.append(t)
if __name__ == '__main__':
suite = unittest.TestSuite()
for test_type in test_types:
test = test_type()
suite.addTest(test)
runner = unittest.TextTestRunner(failfast=True)
result = runner.run(suite)
if not result.wasSuccessful():
sys.exit(1)