File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import sys
2+ import os
3+ import glob
4+ import unittest
5+
6+ #Allow us to import the parent module
7+ os .chdir (os .path .split (os .path .abspath (__file__ ))[0 ])
8+ sys .path .insert (0 , os .path .abspath (os .curdir ))
9+ sys .path .insert (0 , os .path .abspath (os .pardir ))
10+ sys .path .insert (0 , os .path .join (os .path .abspath (os .pardir ), "src" ))
11+
12+ def buildTestSuite ():
13+ suite = unittest .TestSuite ()
14+ for testcase in glob .glob ('test_*.py' ):
15+ if testcase in ("test_tokenizer.py" , "test_parser.py" , "test_parser2.py" ):
16+ module = os .path .splitext (testcase )[0 ]
17+ suite .addTest (__import__ (module ).buildTestSuite ())
18+ return suite
19+
20+ def main ():
21+ results = unittest .TextTestRunner ().run (buildTestSuite ())
22+ return results
23+
24+ if __name__ == "__main__" :
25+ results = main ()
26+ if not results .wasSuccessful ():
27+ sys .exit (1 )
You can’t perform that action at this time.
0 commit comments