-
Notifications
You must be signed in to change notification settings - Fork 211
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
Uncovered files from dirs without __init__.py are not reported #88
Comments
This feature is built into coverage, but with a caveat: you have to use paths for the source. Eg: if you use |
And that's not covered by |
Not really sure, but it sounds like it's not something pytest-cov specific. What behavior do you get if you use plain coverage (eg: If you put an example somewhere I'll take a look. |
👍 same here |
@codingjoe are you having the same issue or you're waiting too on some example that reproduces the issue? 😁 |
Never mind problem gone. I had the same problem too, but only once. Now it's gone, very curious. Made my coverage skyrocket. Now it's back to "normal". |
@blueyed Can you create some minimal project that reproduce the issue? Or at least point to the project that has this problem ... |
I can't even recreate the issue myself. So no, sorry. |
This happens because of a missing coveragepy skips it then (https://github.com/nedbat/coveragepy/blob/e7c532c2dbcef6281df5a7a0db53eca4083a026a/coverage/files.py#L342-L346). This gets used in I think that also "non-importable" files should be included - but that is an issue to raise for coveragepy then probably?! In my case the |
Do we have a bug report for this in https://bitbucket.org/ned/coveragepy? |
I could not find one, and given the comment in https://github.com/nedbat/coveragepy/blob/d5a89ab843542f88544a0f55900093329ef6b85c/coverage/files.py#L331-L346 it might even be not possible?! |
Though I am not sure my case is same case with this report.
See rpm-py-installer/rpm-py-installer#59 for detail. |
Closing this in favour of #176. Add your thoughts there if you want your usecase documented. |
Problem with modules placed in dirs without init files is still exists, while The bug is still exists. In python 3 modules (.py files) doesn't need init files be placed nearby to be able code from these files to be imported. I don't use init files and always import code directly from .py files. The whole lotta applications written without init files and pytest do not cover such dirs (if code from files is not imported or tested somehow in tests runned by pytest). |
The current solution is to use |
For people also ending here, there is the solution: Content of
Adapt the heading to |
It seems like files that are not imported/used are not reported as having 0% coverage.
It would be useful if all the files of the project would be in the coverage report - having a percentage of 0% in case they were not imported/used.
I could imagine that pytest-cov would have to hook into py.test's collection process for this, and then somehow make coverage aware of them - even if they are not imported during tests?!
The text was updated successfully, but these errors were encountered: