diff -r dc171b1d8261 -r 362cd1b6f81a eric6/DebugClients/Python/coverage/plugin_support.py --- a/eric6/DebugClients/Python/coverage/plugin_support.py Wed Feb 19 19:38:36 2020 +0100 +++ b/eric6/DebugClients/Python/coverage/plugin_support.py Sat Feb 22 14:27:42 2020 +0100 @@ -1,5 +1,5 @@ # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt +# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """Support for plugins.""" @@ -21,6 +21,7 @@ self.names = {} self.file_tracers = [] self.configurers = [] + self.context_switchers = [] self.current_module = None self.debug = None @@ -70,6 +71,15 @@ """ self._add_plugin(plugin, self.configurers) + def add_dynamic_context(self, plugin): + """Add a dynamic context plugin. + + `plugin` is an instance of a third-party plugin class. It must + implement the :meth:`CoveragePlugin.dynamic_context` method. + + """ + self._add_plugin(plugin, self.context_switchers) + def add_noop(self, plugin): """Add a plugin that does nothing. @@ -157,6 +167,20 @@ reporter = DebugFileReporterWrapper(filename, reporter, debug) return reporter + def dynamic_context(self, frame): + context = self.plugin.dynamic_context(frame) + self.debug.write("dynamic_context(%r) --> %r" % (frame, context)) + return context + + def find_executable_files(self, src_dir): + executable_files = self.plugin.find_executable_files(src_dir) + self.debug.write("find_executable_files(%r) --> %r" % (src_dir, executable_files)) + return executable_files + + def configure(self, config): + self.debug.write("configure(%r)" % (config,)) + self.plugin.configure(config) + def sys_info(self): return self.plugin.sys_info()