Show More
@@ -324,14 +324,10 b' class ExclusionPlugin(Plugin):' | |||||
324 | ---------- |
|
324 | ---------- | |
325 |
|
325 | |||
326 | exclude_patterns : sequence of strings, optional |
|
326 | exclude_patterns : sequence of strings, optional | |
327 | These patterns are compiled as regular expressions, subsequently used |
|
327 | Filenames containing these patterns (as raw strings, not as regular | |
328 | to exclude any filename which matches them from inclusion in the test |
|
328 | expressions) are excluded from the tests. | |
329 | suite (using pattern.search(), NOT pattern.match() ). |
|
|||
330 | """ |
|
329 | """ | |
331 |
|
330 | self.exclude_patterns = exclude_patterns or [] | ||
332 | if exclude_patterns is None: |
|
|||
333 | exclude_patterns = [] |
|
|||
334 | self.exclude_patterns = [re.compile(p) for p in exclude_patterns] |
|
|||
335 | super(ExclusionPlugin, self).__init__() |
|
331 | super(ExclusionPlugin, self).__init__() | |
336 |
|
332 | |||
337 | def options(self, parser, env=os.environ): |
|
333 | def options(self, parser, env=os.environ): | |
@@ -345,14 +341,14 b' class ExclusionPlugin(Plugin):' | |||||
345 | def wantFile(self, filename): |
|
341 | def wantFile(self, filename): | |
346 | """Return whether the given filename should be scanned for tests. |
|
342 | """Return whether the given filename should be scanned for tests. | |
347 | """ |
|
343 | """ | |
348 |
if any(pat |
|
344 | if any(pat in filename for pat in self.exclude_patterns): | |
349 | return False |
|
345 | return False | |
350 | return None |
|
346 | return None | |
351 |
|
347 | |||
352 | def wantDirectory(self, directory): |
|
348 | def wantDirectory(self, directory): | |
353 | """Return whether the given directory should be scanned for tests. |
|
349 | """Return whether the given directory should be scanned for tests. | |
354 | """ |
|
350 | """ | |
355 |
if any(pat |
|
351 | if any(pat in directory for pat in self.exclude_patterns): | |
356 | return False |
|
352 | return False | |
357 | return None |
|
353 | return None | |
358 |
|
354 |
General Comments 0
You need to be logged in to leave comments.
Login now