Improve fail_under by enabling more refined control on threshold

Issue #666 closed
Former user created an issue

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

Comments (6)

  1. Ned Batchelder repo owner

    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?

  2. Orestis Ioannou

    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.

  3. Ned Batchelder repo owner

    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.

  4. Orestis Ioannou

    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 :)

  5. Log in to comment