MCPcopy Create free account
hub / github.com/ipython/ipython / ExclusionPlugin

Class ExclusionPlugin

IPython/testing/iptest.py:240–278  ·  view source on GitHub ↗

A nose plugin to effect our exclusions of files and directories.

Source from the content-addressed store, hash-verified

238
239
240class ExclusionPlugin(Plugin):
241 """A nose plugin to effect our exclusions of files and directories.
242 """
243 name = 'exclusions'
244 score = 3000 # Should come before any other plugins
245
246 def __init__(self, exclude_patterns=None):
247 """
248 Parameters
249 ----------
250
251 exclude_patterns : sequence of strings, optional
252 Filenames containing these patterns (as raw strings, not as regular
253 expressions) are excluded from the tests.
254 """
255 self.exclude_patterns = exclude_patterns or []
256 super(ExclusionPlugin, self).__init__()
257
258 def options(self, parser, env=os.environ):
259 Plugin.options(self, parser, env)
260
261 def configure(self, options, config):
262 Plugin.configure(self, options, config)
263 # Override nose trying to disable plugin.
264 self.enabled = True
265
266 def wantFile(self, filename):
267 """Return whether the given filename should be scanned for tests.
268 """
269 if any(pat in filename for pat in self.exclude_patterns):
270 return False
271 return None
272
273 def wantDirectory(self, directory):
274 """Return whether the given directory should be scanned for tests.
275 """
276 if any(pat in directory for pat in self.exclude_patterns):
277 return False
278 return None
279
280
281class StreamCapturer(Thread):

Callers 1

run_iptestFunction · 0.85

Calls

no outgoing calls

Tested by 1

run_iptestFunction · 0.68