-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtdd_suite.py
executable file
·63 lines (43 loc) · 1.2 KB
/
tdd_suite.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
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
'''
./tdd_suite.py test; red_green_bar.py $? $COLUMNS
'''
import sys
import unittest
class TestSimpleExample(unittest.TestCase):
def test_simple_example(self):
'''
TestSimpleExample:
'''
self.assertEqual(0, 1)
fast_test_ls = [
TestSimpleExample,
]
slow_test_ls = [
TestSimpleExample,
]
def add_all_fast(suite):
for one_test in fast_test_ls:
suite.addTest(unittest.makeSuite(one_test))
def add_all_slow(suite):
for one_test in slow_test_ls:
suite.addTest(unittest.makeSuite(one_test))
def summary_status(suite):
text_test_result = unittest.TextTestRunner().run(suite)
return not not (text_test_result.failures or text_test_result.errors)
def perform_tests():
suite = unittest.TestSuite()
add_all_fast(suite)
return summary_status(suite)
def perform_slow_tests():
suite = unittest.TestSuite()
add_all_fast(suite)
add_all_slow(suite)
return summary_status(suite)
if __name__ == '__main__':
if len(sys.argv) >= 2 and sys.argv[1] == 'slowtest':
result = perform_slow_tests()
else:
result = perform_tests()
sys.exit(result)