Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anetbnd opened this issue Aug 6, 2019 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@anetbnd
Copy link

anetbnd commented Aug 6, 2019

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
@anetbnd anetbnd added the bug Something isn't working label Aug 6, 2019
@nedbat
Copy link
Owner

nedbat commented Aug 11, 2019

Thanks for the detailed issue. This is fixed in 48660ff

@nedbat nedbat closed this as completed Aug 11, 2019
@anetbnd
Copy link
Author

anetbnd commented Aug 12, 2019

Thanks for fixing 👍

@nedbat
Copy link
Owner

nedbat commented Sep 21, 2019

This is in 5.0a7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants