diff options
-rw-r--r-- | CHANGES.rst | 4 | ||||
-rw-r--r-- | coverage/control.py | 18 | ||||
-rw-r--r-- | tests/test_plugins.py | 12 |
3 files changed, 21 insertions, 13 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index ad401eb5..e18f9dc7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,7 +20,7 @@ Unreleased ---------- - Now that 4.5 properly separated the ``[run] omit`` and ``[report] omit`` - settings, and old bug has become apparent. If you specified a package name + settings, an old bug has become apparent. If you specified a package name for ``[run] source``, then omit patterns weren't matched inside that package. This bug (`issue 638`_) is now fixed. @@ -28,6 +28,8 @@ Unreleased docstring would crash coverage.py with an IndexError (`issue 640`_). This is now fixed. +- Configurer plugins are now being reported in the output of ``--debug=sys``. + .. _issue 638: https://bitbucket.org/ned/coveragepy/issues/638/run-omit-is-ignored-since-45 .. _issue 640: https://bitbucket.org/ned/coveragepy/issues/640/indexerror-reporting-on-an-empty-decorated diff --git a/coverage/control.py b/coverage/control.py index 71692de6..b82c8047 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -1152,12 +1152,15 @@ class Coverage(object): self._init() - ft_plugins = [] - for ft in self.plugins.file_tracers: - ft_name = ft._coverage_plugin_name - if not ft._coverage_enabled: - ft_name += " (disabled)" - ft_plugins.append(ft_name) + def plugin_info(plugins): + """Make an entry for the sys_info from a list of plug-ins.""" + entries = [] + for plugin in plugins: + entry = plugin._coverage_plugin_name + if not plugin._coverage_enabled: + entry += " (disabled)" + entries.append(entry) + return entries info = [ ('version', covmod.__version__), @@ -1165,7 +1168,8 @@ class Coverage(object): ('cover_paths', self.cover_paths), ('pylib_paths', self.pylib_paths), ('tracer', self.collector.tracer_name()), - ('plugins.file_tracers', ft_plugins), + ('plugins.file_tracers', plugin_info(self.plugins.file_tracers)), + ('plugins.configurers', plugin_info(self.plugins.configurers)), ('config_files', self.config.attempted_config_files), ('configs_read', self.config.config_files), ('data_path', self.data_files.filename), diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 2e8d52f8..07752763 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -183,7 +183,7 @@ class PluginTest(CoverageTest): return [("hello", "world")] def coverage_init(reg, options): - reg.add_noop(Plugin()) + reg.add_file_tracer(Plugin()) """) debug_out = StringIO() cov = coverage.Coverage(debug=["sys"]) @@ -191,10 +191,11 @@ class PluginTest(CoverageTest): cov.set_option("run:plugins", ["plugin_sys_info"]) cov.load() - out_lines = debug_out.getvalue().splitlines() + out_lines = [line.strip() for line in debug_out.getvalue().splitlines()] + self.assertIn('plugins.file_tracers: plugin_sys_info.Plugin', out_lines) expected_end = [ "-- sys: plugin_sys_info.Plugin -------------------------------", - " hello: world", + "hello: world", "-- end -------------------------------------------------------", ] self.assertEqual(expected_end, out_lines[-len(expected_end):]) @@ -207,7 +208,7 @@ class PluginTest(CoverageTest): pass def coverage_init(reg, options): - reg.add_noop(Plugin()) + reg.add_configurer(Plugin()) """) debug_out = StringIO() cov = coverage.Coverage(debug=["sys"]) @@ -215,7 +216,8 @@ class PluginTest(CoverageTest): cov.set_option("run:plugins", ["plugin_no_sys_info"]) cov.load() - out_lines = debug_out.getvalue().splitlines() + out_lines = [line.strip() for line in debug_out.getvalue().splitlines()] + self.assertIn('plugins.configurers: plugin_no_sys_info.Plugin', out_lines) expected_end = [ "-- sys: plugin_no_sys_info.Plugin ----------------------------", "-- end -------------------------------------------------------", |