-
Notifications
You must be signed in to change notification settings - Fork 35
/
test_formalsystems.py
58 lines (42 loc) · 1.32 KB
/
test_formalsystems.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import doctest
import os
import sys
# Managing path
DIRNAME = os.path.abspath(os.path.dirname(__file__))
UP_DIR = os.path.dirname(DIRNAME)
if UP_DIR not in sys.path:
sys.path.append(UP_DIR)
# Now we can import the tested packages/modules
from formalsystems import formalsystems, leplparsing
class TestFormalSystems(unittest.TestCase):
def setUp(self):
pass
if __name__ == '__main__':
# Going in tests directory
os.chdir(DIRNAME)
flags = (
doctest.ELLIPSIS |
doctest.NORMALIZE_WHITESPACE
)
# Would run only local unit tests
#unittest.main()
tests = unittest.TestSuite()
tests.addTests(unittest.makeSuite(TestFormalSystems))
tests.addTests(doctest.DocTestSuite(formalsystems))
tests.addTests(doctest.DocTestSuite(leplparsing))
tests.addTests(doctest.DocFileSuite('./README.rst',
module_relative=False,
optionflags=flags))
# Test runner
verbosity = 0
if len(sys.argv) >= 2:
first_arg = sys.argv[1].strip()
if first_arg == '-vv':
verbosity = 2
elif first_arg == '-v':
verbosity = 1
runner = unittest.TextTestRunner(verbosity=verbosity)
runner.run(tests)