diff options
author | Justas Sadzevičius <justas.sadzevicius@gmail.com> | 2019-04-21 06:02:09 +0300 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-04-20 23:02:09 -0400 |
commit | 4a5ad41f106d6d9fff97e10cae3571b7b67823d5 (patch) | |
tree | 1c1555ea6cb2c86f15dc528ce65d0e34e62e4e32 /coverage/plugin_support.py | |
parent | a92f0023e015a82f8c875e7a90210e22aaf0174b (diff) | |
download | python-coveragepy-git-4a5ad41f106d6d9fff97e10cae3571b7b67823d5.tar.gz |
Plugin support for dynamic context (#783)
* Introduce a new plugin type: dynamic context labels.
* Test dynamic context plugins
* Helper method to get full paths to measured files
* Get correct filenames on all OS
* Improve wording
Diffstat (limited to 'coverage/plugin_support.py')
-rw-r--r-- | coverage/plugin_support.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/coverage/plugin_support.py b/coverage/plugin_support.py index 0727a3b0..7c25a5f1 100644 --- a/coverage/plugin_support.py +++ b/coverage/plugin_support.py @@ -21,6 +21,7 @@ class Plugins(object): self.names = {} self.file_tracers = [] self.configurers = [] + self.context_switchers = [] self.current_module = None self.debug = None @@ -70,6 +71,15 @@ class Plugins(object): """ 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. |