Skip to content

Commit 50f838a

Browse files
committed
Python parser: add a special test file that just tests parser regressions
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401108
1 parent 3385106 commit 50f838a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/runparsertests.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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)

0 commit comments

Comments
 (0)