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

Python coverage cannot exclude lines #8234

Closed
chysi opened this issue Sep 3, 2019 · 2 comments
Closed

Python coverage cannot exclude lines #8234

chysi opened this issue Sep 3, 2019 · 2 comments

Comments

@chysi
Copy link

chysi commented Sep 3, 2019

The pants documentation on this is extremely lacking. I was searching around the codebase, and the coverage.py way of using # pragma: no cover no longer works since release 1.5.0dev0 (see #5363), having been explicitly readded in #4232. I could find no discussion on this, so I am assuming that this was an accident. Is that the case?

@chysi
Copy link
Author

chysi commented Sep 4, 2019

On further investigation, the underlying issue appears to be that the exclude_list generated is not honored at all. The generated .coveragerc includes def __repr__ and raise NotImplementedError as exclude regexes, but these lines are still included in the report by pytest-cov.

@chysi chysi changed the title Coverage pragmas accidentally removed? Python coverage cannot exclude lines Sep 4, 2019
@Eric-Arellano
Copy link
Contributor

Hey @chysi, sorry no one replied to this. We agree that Coverage documentation was very lacking. The original implementation was also not great.

We ended up redesigning Pants' coverage implementation from the ground up as part of the upcoming Pants 2.0 release. Among several other changes, we no longer use a custom plugin, and allow you to set your own .coveragerc. See https://www.pantsbuild.org/v2.0/docs/python-test-goal#coverage.

We're hoping to release Pants 2.0 in the next few weeks. In the meantime, we'd be happy to help you get set up trying a dev release. We also have a Google group where we announce new releases. See https://www.pantsbuild.org/v2.0/docs/community for how to join our Slack and/or Google Group.

Again, sorry that we dropped the ball here!

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

2 participants