From: Dag Sverre Seljebotn Date: Thu, 19 Jun 2008 17:44:58 +0000 (-0700) Subject: Regex matching for unit tests X-Git-Tag: 0.9.8.1~49^2~119 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=185adaa1bdc4972b5f2c4a9bc394e9a946995483;p=cython.git Regex matching for unit tests --- diff --git a/runtests.py b/runtests.py index a91b3aaf..5706201e 100644 --- a/runtests.py +++ b/runtests.py @@ -238,7 +238,7 @@ class CythonRunTestCase(CythonCompileTestCase): except Exception: pass -def collect_unittests(path, suite): +def collect_unittests(path, suite, selectors): def file_matches(filename): return filename.startswith("Test") and filename.endswith(".py") @@ -254,6 +254,8 @@ def collect_unittests(path, suite): if file_matches(f): filepath = os.path.join(dirpath, f)[:-len(".py")] modulename = filepath[len(path)+1:].replace(os.path.sep, '.') + if not [ 1 for match in selectors if match(modulename) ]: + continue module = __import__(modulename) for x in modulename.split('.')[1:]: module = getattr(module, x) @@ -326,7 +328,7 @@ if __name__ == '__main__': test_suite = unittest.TestSuite() if options.unittests: - collect_unittests(os.getcwd(), test_suite) + collect_unittests(os.getcwd(), test_suite, selectors) if options.filetests: filetests = TestBuilder(ROOTDIR, WORKDIR, selectors,