67 `plugin` is an instance of a third-party plugin class. It must |
68 `plugin` is an instance of a third-party plugin class. It must |
68 implement the :meth:`CoveragePlugin.configure` method. |
69 implement the :meth:`CoveragePlugin.configure` method. |
69 |
70 |
70 """ |
71 """ |
71 self._add_plugin(plugin, self.configurers) |
72 self._add_plugin(plugin, self.configurers) |
|
73 |
|
74 def add_dynamic_context(self, plugin): |
|
75 """Add a dynamic context plugin. |
|
76 |
|
77 `plugin` is an instance of a third-party plugin class. It must |
|
78 implement the :meth:`CoveragePlugin.dynamic_context` method. |
|
79 |
|
80 """ |
|
81 self._add_plugin(plugin, self.context_switchers) |
72 |
82 |
73 def add_noop(self, plugin): |
83 def add_noop(self, plugin): |
74 """Add a plugin that does nothing. |
84 """Add a plugin that does nothing. |
75 |
85 |
76 This is only useful for testing the plugin support. |
86 This is only useful for testing the plugin support. |
155 if reporter: |
165 if reporter: |
156 debug = self.debug.add_label("file %r" % (filename,)) |
166 debug = self.debug.add_label("file %r" % (filename,)) |
157 reporter = DebugFileReporterWrapper(filename, reporter, debug) |
167 reporter = DebugFileReporterWrapper(filename, reporter, debug) |
158 return reporter |
168 return reporter |
159 |
169 |
|
170 def dynamic_context(self, frame): |
|
171 context = self.plugin.dynamic_context(frame) |
|
172 self.debug.write("dynamic_context(%r) --> %r" % (frame, context)) |
|
173 return context |
|
174 |
|
175 def find_executable_files(self, src_dir): |
|
176 executable_files = self.plugin.find_executable_files(src_dir) |
|
177 self.debug.write("find_executable_files(%r) --> %r" % (src_dir, executable_files)) |
|
178 return executable_files |
|
179 |
|
180 def configure(self, config): |
|
181 self.debug.write("configure(%r)" % (config,)) |
|
182 self.plugin.configure(config) |
|
183 |
160 def sys_info(self): |
184 def sys_info(self): |
161 return self.plugin.sys_info() |
185 return self.plugin.sys_info() |
162 |
186 |
163 |
187 |
164 class DebugFileTracerWrapper(FileTracer): |
188 class DebugFileTracerWrapper(FileTracer): |