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

Failing to omit files through setup.cfg #1558

Closed
SebastienMorais opened this issue Feb 20, 2023 · 5 comments
Closed

Failing to omit files through setup.cfg #1558

SebastienMorais opened this issue Feb 20, 2023 · 5 comments
Labels
docs good first This could be a good first contribution

Comments

@SebastienMorais
Copy link

Describe the bug
In my setup.cfg file, I specify that i want to omit my test files when measuring coverage:

[coverage:run]
omit = *tests/*

While this worked a few version ago (at least in 6.5), current version (7.1.0) does not omit the tests files.
This can be fixed with the following setup

[coverage:run]
omit = my_package/tests/*

Although it is possible to make everything work (as specified), I am surprised that my previous configuration no longer works.

To Reproduce
I'm using python 3.8.14 with coverage 6.5 and pytest 7.2.1.
The command used is:
coverage run -m pytest --cov=my_package --cov-fail-under=95 --cov-config=setup.cfg

Expected behavior
I would expect that omit through *tests/* would omit every files contained in my_package/tests/

@SebastienMorais SebastienMorais added bug Something isn't working needs triage labels Feb 20, 2023
@nedbat
Copy link
Owner

nedbat commented Apr 24, 2023

The interpretation of wildcards changed between 6.x and 7.x. It will work if you use omit = */tests/* I think. In 6.x, * would match a directory separator, but now it does not.

@nedbat nedbat closed this as completed Apr 24, 2023
@nedbat nedbat added good first This could be a good first contribution and removed needs triage labels Apr 24, 2023
@nedbat
Copy link
Owner

nedbat commented Apr 24, 2023

I think we could use a more complete description of the wildcard changes, and how to adjust settings when moving from 6.x to 7.x.

@nedbat nedbat added docs and removed bug Something isn't working labels Apr 24, 2023
@nedbat nedbat reopened this Apr 24, 2023
@paxnovem
Copy link
Sponsor Contributor

Working on this for the Pycon2023 sprints

@SebastienMorais
Copy link
Author

The interpretation of wildcards changed between 6.x and 7.x. It will work if you use omit = */tests/* I think. In 6.x, * would match a directory separator, but now it does not.

Indeed, it works 👍

@nedbat
Copy link
Owner

nedbat commented Apr 25, 2023

@paxnovem added migration notes in commit d6e621a. I hope that will avoid future confusion.

@nedbat nedbat closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs good first This could be a good first contribution
Projects
None yet
Development

No branches or pull requests

3 participants