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

Improve fail_under by enabling more refined control on threshold #666

Open
nedbat opened this issue Jun 19, 2018 · 7 comments
Open

Improve fail_under by enabling more refined control on threshold #666

nedbat opened this issue Jun 19, 2018 · 7 comments
Labels
enhancement New feature or request target

Comments

@nedbat
Copy link
Owner

nedbat commented Jun 19, 2018

Originally reported by Anonymous


Hello,

I didn't find this option anywhere in the documentation so i hope i haven't missed anything.
The idea is that right now we can only set a global minimum threshold percentage on coverage. While this is really useful i suggest coverage could provide a more refined control on this requirement such as per module minimum percentage.

Taking for example jest (https://facebook.github.io/jest/docs/en/configuration.html#coveragethreshold-object) it would be really great if i could set in the report section my requirements like maybe a list of regexes with minimum requirements.

  • api/* -> 40%
  • db/* -> 80%

Thanks in advance


@nedbat
Copy link
Owner Author

nedbat commented Jun 19, 2018

Interesting idea, but it seems very specialized for something like coverage. A separate tool could look at the coverage report, and make this kind of assessment. Would that work for you?

@nedbat
Copy link
Owner Author

nedbat commented Jun 19, 2018

Original comment by Orestis Ioannou (Bitbucket: oorestisime, GitHub: oorestisime)


I guess so yes, do you have a tool in mind?

@nedbat
Copy link
Owner Author

nedbat commented Jun 19, 2018

Original comment by Orestis Ioannou (Bitbucket: oorestisime, GitHub: oorestisime)


Maybe this could be added to pytest-cov although i am not sure whether they would want this or if it is better to support this kind of feature directly in coverage so that all the runners could benefit from it.

@nedbat
Copy link
Owner Author

nedbat commented Jun 20, 2018

I don;t have a specific tool in mind. It could even be a new tool that you run after coverage, to make a detailed assessment of the results. It doesn't have to be added to anything existing.

@nedbat
Copy link
Owner Author

nedbat commented Jun 20, 2018

Original comment by Orestis Ioannou (Bitbucket: oorestisime, GitHub: oorestisime)


ok right, if you are nonetheless willing to let this go in coverage i could have a look on how to implement this and propose a PR. otherwise i guess i should close the issue :)

@nedbat
Copy link
Owner Author

nedbat commented Oct 9, 2018

A JSON report (#720) would make it possible to implement this feature, especially if it included sub-totals for each directory of code.

@nedbat
Copy link
Owner Author

nedbat commented Dec 11, 2021

See https://nedbatchelder.com/blog/202111/coverage_goals.html for some progress on a tool to do this.

@nedbat nedbat added target and removed report labels Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request target
Projects
None yet
Development

No branches or pull requests

1 participant