Skip to content

Code coverage is starting too late, even when using pytest without any other tools #188

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

Open
mark0978 opened this issue Feb 5, 2018 · 2 comments

Comments

@mark0978
Copy link

mark0978 commented Feb 5, 2018

I'm using:

pytest -n 8 -xv --cov --cov-config ./.coveragerc --cov-report html --cov-append -s 

and

pytest -n 1 -xv --cov --cov-config ./.coveragerc --cov-report html --cov-append -s 

and it appears coverage is getting started after some of the modules have been imported.

Running

coverage run `which pytest`

solves this problem, but it seems like the pytest-cov plugin shouldn't need this.

The bizarre part is that it doesn't affect all of the files, some of my files do have 100% coverage, but there are quite a few files where the def is not covered but the body is which is telling me something is happening in the wrong order.

I really want to use py-cov because I can run with -n 8

Any ideas?

@will133
Copy link

will133 commented May 1, 2018

I think I've seen this as well. I'm writing a custom plugin where the coverage is very misleading since some of the plugin code's module gets loaded so the definitions are not covered. I can't seem to find a way to exclude those or make the test cover them.

@blueyed
Copy link
Contributor

blueyed commented Sep 16, 2018

Check out https://pytest-cov.readthedocs.io/en/latest/plugins.html - but it also needs --cov apparently (#223).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants