From 71dcfc15b1c90c7db4870368f57b7898fc424822 2013-09-23 19:13:48 From: Thomas Kluyver Date: 2013-09-23 19:13:48 Subject: [PATCH] Use plain string searching for test exclusions. Closes gh-4243 --- diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index b20e315..c263bc9 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -324,14 +324,10 @@ class ExclusionPlugin(Plugin): ---------- exclude_patterns : sequence of strings, optional - These patterns are compiled as regular expressions, subsequently used - to exclude any filename which matches them from inclusion in the test - suite (using pattern.search(), NOT pattern.match() ). + Filenames containing these patterns (as raw strings, not as regular + expressions) are excluded from the tests. """ - - if exclude_patterns is None: - exclude_patterns = [] - self.exclude_patterns = [re.compile(p) for p in exclude_patterns] + self.exclude_patterns = exclude_patterns or [] super(ExclusionPlugin, self).__init__() def options(self, parser, env=os.environ): @@ -345,14 +341,14 @@ class ExclusionPlugin(Plugin): def wantFile(self, filename): """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 None def wantDirectory(self, directory): """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 None