18 |
18 |
19 def __init__(self): |
19 def __init__(self): |
20 self.order = [] |
20 self.order = [] |
21 self.names = {} |
21 self.names = {} |
22 self.file_tracers = [] |
22 self.file_tracers = [] |
|
23 self.configurers = [] |
23 |
24 |
24 self.current_module = None |
25 self.current_module = None |
25 self.debug = None |
26 self.debug = None |
26 |
27 |
27 @classmethod |
28 @classmethod |
28 def load_plugins(cls, modules, config, debug=None): |
29 def load_plugins(cls, modules, config, debug=None): |
29 """Load plugins from `modules`. |
30 """Load plugins from `modules`. |
30 |
31 |
31 Returns a list of loaded and configured plugins. |
32 Returns a Plugins object with the loaded and configured plugins. |
32 |
33 |
33 """ |
34 """ |
34 plugins = cls() |
35 plugins = cls() |
35 plugins.debug = debug |
36 plugins.debug = debug |
36 |
37 |
57 `plugin` is an instance of a third-party plugin class. It must |
58 `plugin` is an instance of a third-party plugin class. It must |
58 implement the :meth:`CoveragePlugin.file_tracer` method. |
59 implement the :meth:`CoveragePlugin.file_tracer` method. |
59 |
60 |
60 """ |
61 """ |
61 self._add_plugin(plugin, self.file_tracers) |
62 self._add_plugin(plugin, self.file_tracers) |
|
63 |
|
64 def add_configurer(self, plugin): |
|
65 """Add a configuring plugin. |
|
66 |
|
67 `plugin` is an instance of a third-party plugin class. It must |
|
68 implement the :meth:`CoveragePlugin.configure` method. |
|
69 |
|
70 """ |
|
71 self._add_plugin(plugin, self.configurers) |
62 |
72 |
63 def add_noop(self, plugin): |
73 def add_noop(self, plugin): |
64 """Add a plugin that does nothing. |
74 """Add a plugin that does nothing. |
65 |
75 |
66 This is only useful for testing the plugin support. |
76 This is only useful for testing the plugin support. |