Merge pull request #4259 from takluyver/win-test-exclusions

Fix Windows test exclusions
This commit is contained in:
Thomas Kluyver 2013-09-23 14:45:00 -07:00
commit 3905145dff

View File

@ -324,14 +324,10 @@ class ExclusionPlugin(Plugin):
---------- ----------
exclude_patterns : sequence of strings, optional exclude_patterns : sequence of strings, optional
These patterns are compiled as regular expressions, subsequently used Filenames containing these patterns (as raw strings, not as regular
to exclude any filename which matches them from inclusion in the test expressions) are excluded from the tests.
suite (using pattern.search(), NOT pattern.match() ).
""" """
self.exclude_patterns = exclude_patterns or []
if exclude_patterns is None:
exclude_patterns = []
self.exclude_patterns = [re.compile(p) for p in exclude_patterns]
super(ExclusionPlugin, self).__init__() super(ExclusionPlugin, self).__init__()
def options(self, parser, env=os.environ): def options(self, parser, env=os.environ):
@ -345,14 +341,14 @@ class ExclusionPlugin(Plugin):
def wantFile(self, filename): def wantFile(self, filename):
"""Return whether the given filename should be scanned for tests. """Return whether the given filename should be scanned for tests.
""" """
if any(pat.search(filename) for pat in self.exclude_patterns): if any(pat in filename for pat in self.exclude_patterns):
return False return False
return None return None
def wantDirectory(self, directory): def wantDirectory(self, directory):
"""Return whether the given directory should be scanned for tests. """Return whether the given directory should be scanned for tests.
""" """
if any(pat.search(directory) for pat in self.exclude_patterns): if any(pat in directory for pat in self.exclude_patterns):
return False return False
return None return None