Why my method signature is not marked as covered?
Hi,
When I run code coverage with pytest --cov=xxx it shows that the lines inside my class method is covered but not the method signature line:

Same for the class definition line and the import lines on the top of the file:

Is there an option to turn this on? Thanks!
It appears that your code is imported before pytest-cov starts measuring coverage (eg: you have a custom pytest plugin that imports it or some other weird thing going on). I guess you could try to make a reproducer and we find a solution but you can also just run coverage run -m pytest instead (assuming you don't need pytest-cov's subprocess stuff).
See: https://pytest-cov.readthedocs.io/en/latest/plugins.html
Hi, was this issue ever addressed? I am also experiencing the same with pytest cov and would rather use it over coverage because of the way I have things configured right now.
This issue happens if a fixture is referenced as entry point https://docs.pytest.org/en/6.2.x/writing_plugins.html#setuptools-entry-points .
This happened to me in that case, which made me do a conditional in the setup.py (in case of testing) to fix this issue.
Only supposition but I assume that adding the fixture as entry point force the loading of the module before the coverage start. And as definition of function/classes happens only once, it is not considered as covered when the test run.