[report] omit overwrites [run] omit

Issue #622 resolved
Max Nordlund created an issue

First let me say thanks for providing such an amazing tool, really makes a huge difference for code health.

I'm using pytest-cov, but it doesn't parse the .coveragerc so I believe it's a coverage bug. Basically if you provide an omit option in [run] and [report] the last in the file wins.

This is because both store their value in _omit, as you can see here. I'm not sure how to fix it though, as I just started to read through the source.

Comments (7)

  1. Ned Batchelder repo owner

    Thanks for using coverage.py. Can you provide more detail? If reporting is going to omit a file, then why is it a problem for run to omit it?

  2. Max Nordlund reporter

    I want to exclude some files completely, not contributing to the global coverage score, but there are some I would like to avoid in the report even if they contribute to the total.

    It sounds kind of weird, but it's to reduce noise until coverage goes up enough. It's a legacy project and ~50% is covered so for now I want to filter out a bit more aggressively. But at the same time don't get the false impression that coverage is going up. Something like how :skip-covered reports how many files it skipped, and improves signal-to-noise.

    Now, it would be sort of OK for run to omit what report is omitting, but it currently it overwrites the run omit with the report omit, which means it let's through a bunch of files that shouldn't be covered.

    Does this make it clearer?

  3. Log in to comment