Commit fce63177 authored by Stefan Behnel's avatar Stefan Behnel

allow explicitly running the tests in tests/bugs

parent 0aa615e6
...@@ -66,7 +66,7 @@ class ErrorWriter(object): ...@@ -66,7 +66,7 @@ class ErrorWriter(object):
class TestBuilder(object): class TestBuilder(object):
def __init__(self, rootdir, workdir, selectors, exclude_selectors, annotate, def __init__(self, rootdir, workdir, selectors, exclude_selectors, annotate,
cleanup_workdir, cleanup_sharedlibs, with_pyregr, cython_only, cleanup_workdir, cleanup_sharedlibs, with_pyregr, cython_only,
languages): languages, test_bugs):
self.rootdir = rootdir self.rootdir = rootdir
self.workdir = workdir self.workdir = workdir
self.selectors = selectors self.selectors = selectors
...@@ -77,9 +77,13 @@ class TestBuilder(object): ...@@ -77,9 +77,13 @@ class TestBuilder(object):
self.with_pyregr = with_pyregr self.with_pyregr = with_pyregr
self.cython_only = cython_only self.cython_only = cython_only
self.languages = languages self.languages = languages
self.test_bugs = test_bugs
def build_suite(self): def build_suite(self):
suite = unittest.TestSuite() suite = unittest.TestSuite()
test_dirs = TEST_DIRS
if self.test_bugs and 'bugs' not in test_dirs:
test_dirs.append('bugs')
filenames = os.listdir(self.rootdir) filenames = os.listdir(self.rootdir)
filenames.sort() filenames.sort()
for filename in filenames: for filename in filenames:
...@@ -87,7 +91,7 @@ class TestBuilder(object): ...@@ -87,7 +91,7 @@ class TestBuilder(object):
# we won't get any errors without running Cython # we won't get any errors without running Cython
continue continue
path = os.path.join(self.rootdir, filename) path = os.path.join(self.rootdir, filename)
if os.path.isdir(path) and filename in TEST_DIRS: if os.path.isdir(path) and filename in test_dirs:
if filename == 'pyregr' and not self.with_pyregr: if filename == 'pyregr' and not self.with_pyregr:
continue continue
suite.addTest( suite.addTest(
...@@ -552,6 +556,11 @@ if __name__ == '__main__': ...@@ -552,6 +556,11 @@ if __name__ == '__main__':
sys.stderr.write("Python %s\n" % sys.version) sys.stderr.write("Python %s\n" % sys.version)
sys.stderr.write("\n") sys.stderr.write("\n")
test_bugs = False
for selector in cmd_args:
if selector.startswith('bugs'):
test_bugs = True
import re import re
selectors = [ re.compile(r, re.I|re.U).search for r in cmd_args ] selectors = [ re.compile(r, re.I|re.U).search for r in cmd_args ]
if not selectors: if not selectors:
...@@ -585,7 +594,7 @@ if __name__ == '__main__': ...@@ -585,7 +594,7 @@ if __name__ == '__main__':
filetests = TestBuilder(ROOTDIR, WORKDIR, selectors, exclude_selectors, filetests = TestBuilder(ROOTDIR, WORKDIR, selectors, exclude_selectors,
options.annotate_source, options.cleanup_workdir, options.annotate_source, options.cleanup_workdir,
options.cleanup_sharedlibs, options.pyregr, options.cleanup_sharedlibs, options.pyregr,
options.cython_only, languages) options.cython_only, languages, test_bugs)
test_suite.addTest(filetests.build_suite()) test_suite.addTest(filetests.build_suite())
if options.system_pyregr and languages: if options.system_pyregr and languages:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment