Commit 634e1bc8 authored by Stefan Behnel's avatar Stefan Behnel

minor code cleanup

parent 31bb39f0
...@@ -1179,8 +1179,10 @@ class CythonPyregrTestCase(CythonRunTestCase): ...@@ -1179,8 +1179,10 @@ class CythonPyregrTestCase(CythonRunTestCase):
run_forked_test(result, run_test, self.shortDescription(), self.fork) run_forked_test(result, run_test, self.shortDescription(), self.fork)
include_debugger = IS_CPYTHON and sys.version_info[:2] > (2, 5) include_debugger = IS_CPYTHON and sys.version_info[:2] > (2, 5)
def collect_unittests(path, module_prefix, suite, selectors, exclude_selectors): def collect_unittests(path, module_prefix, suite, selectors, exclude_selectors):
def file_matches(filename): def file_matches(filename):
return filename.startswith("Test") and filename.endswith(".py") return filename.startswith("Test") and filename.endswith(".py")
...@@ -1211,9 +1213,9 @@ def collect_unittests(path, module_prefix, suite, selectors, exclude_selectors): ...@@ -1211,9 +1213,9 @@ def collect_unittests(path, module_prefix, suite, selectors, exclude_selectors):
if file_matches(f): if file_matches(f):
filepath = os.path.join(dirpath, f)[:-len(".py")] filepath = os.path.join(dirpath, f)[:-len(".py")]
modulename = module_prefix + filepath[len(path)+1:].replace(os.path.sep, '.') modulename = module_prefix + filepath[len(path)+1:].replace(os.path.sep, '.')
if not [ 1 for match in selectors if match(modulename) ]: if not any(1 for match in selectors if match(modulename)):
continue continue
if [ 1 for match in exclude_selectors if match(modulename) ]: if any(1 for match in exclude_selectors if match(modulename)):
continue continue
module = __import__(modulename) module = __import__(modulename)
for x in modulename.split('.')[1:]: for x in modulename.split('.')[1:]:
...@@ -1221,7 +1223,6 @@ def collect_unittests(path, module_prefix, suite, selectors, exclude_selectors): ...@@ -1221,7 +1223,6 @@ def collect_unittests(path, module_prefix, suite, selectors, exclude_selectors):
suite.addTests([loader.loadTestsFromModule(module)]) suite.addTests([loader.loadTestsFromModule(module)])
def collect_doctests(path, module_prefix, suite, selectors, exclude_selectors): def collect_doctests(path, module_prefix, suite, selectors, exclude_selectors):
def package_matches(dirname): def package_matches(dirname):
if dirname == 'Debugger' and not include_debugger: if dirname == 'Debugger' and not include_debugger:
......
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