summaryrefslogtreecommitdiff
path: root/coverage/collector.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/collector.py')
-rw-r--r--coverage/collector.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/coverage/collector.py b/coverage/collector.py
index a042357f..3545ab1e 100644
--- a/coverage/collector.py
+++ b/coverage/collector.py
@@ -256,6 +256,8 @@ class Collector(object):
if hasattr(tracer, 'should_start_context'):
tracer.should_start_context = self.should_start_context
tracer.switch_context = self.switch_context
+ if hasattr(tracer, 'disable_plugin'):
+ tracer.disable_plugin = self.disable_plugin
fn = tracer.start()
self.tracers.append(tracer)
@@ -381,6 +383,15 @@ class Collector(object):
context = new_context
self.covdata.set_context(context)
+ def disable_plugin(self, disposition):
+ """Disable the plugin mentioned in `disposition`."""
+ file_tracer = disposition.file_tracer
+ plugin = file_tracer._coverage_plugin
+ plugin_name = plugin._coverage_plugin_name
+ self.warn("Disabling plug-in {!r} due to previous exception".format(plugin_name))
+ plugin._coverage_enabled = False
+ disposition.trace = False
+
def cached_mapped_file(self, filename):
"""A locally cached version of file names mapped through file_mapper."""
key = (type(filename), filename)