Skip to content

configurere-plugin is not working with debug=plugin option in .converagerc #834

@anetbnd

Description

@anetbnd

Describe the bug
When you set the debug=plugin option inside your .coveragerc the configurer-plugin is not working anymore.
The reason is, that with debug=plugin the plugin is wrapped in the class DebugPluginWrapper. However, this wrapper is not passing through the call of the configure(...) method.

To Reproduce
File main.py:

import coverage           
cov = coverage.Coverage() 
cov.erase()
cov.start()               

print("I do nothing")

cov.stop()                
cov.save()    

File: configurer_plugin.py :

import coverage

class ConfigurerPlugin(coverage.CoveragePlugin):
    _executed = False
    
    def configure(self, config):
        self._executed = True
        
    def sys_info(self):
        return [('configure_was_executed', self._executed)]
        

def coverage_init(reg, options):
    reg.add_configurer(ConfigurerPlugin())

File: .coveragerc

[run]
debug=
    plugin
    sys
plugins=
    configurer_plugin

Then execute:
python main.py

The expected sys-debug output is:

-- sys -------------------------------------------------------
              version: 4.5.4
[...]
 plugins.file_tracers: -none-
  plugins.configurers: configurer_plugin.ConfigurerPlugin
         config_files: .coveragerc
         configs_read: .coveragerc
            data_path: c:\Projects\torch\patterns\coverage_plugin_issue\.coverage
               python: 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
             platform: Windows-10-10.0.15063-SP0
[...]
-- sys: configurer_plugin.ConfigurerPlugin -------------------
 configure_was_executed: True
-- end -------------------------------------------------------

This output, you will get by disabling the plugin option for debug in the .coveragerc. However, with the 4.5.4 version of coverage.py you only get:

-- sys -------------------------------------------------------
              version: 4.5.4
[...]
 plugins.file_tracers: -none-
  plugins.configurers: configurer_plugin.ConfigurerPlugin
         config_files: .coveragerc
         configs_read: .coveragerc
            data_path: c:\Projects\torch\patterns\coverage_plugin_issue\.coverage
               python: 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
             platform: Windows-10-10.0.15063-SP0
[...]
-- sys: configurer_plugin.ConfigurerPlugin -------------------
 configure_was_executed: False
-- end -------------------------------------------------------

My pip list says:

Package            Version
------------------ ---------
asciimatics        1.11.0
atomicwrites       1.3.0
attrs              19.1.0
certifi            2019.6.16
colorama           0.4.1
coverage           4.5.4
future             0.17.1
importlib-metadata 0.19
more-itertools     7.2.0
numpy              1.17.0
packaging          19.1
Pillow             6.1.0
pip                19.1.1
pluggy             0.12.0
pure-interface     3.5.2
py                 1.8.0
pyfiglet           0.8.post1
pyparsing          2.4.2
pypiwin32          223
pytest             5.0.1
pytest-cov         2.7.1
pytest-pythonpath  0.7.3
pywin32            224
setuptools         41.0.1
six                1.12.0
typing             3.7.4
wcwidth            0.1.7
wheel              0.33.4
wincertstore       0.2
zipp               0.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions