Skip to content

"Run Test with Coverage" should allow omitting files from the report #24309

Closed

Description

@bersbersbers

"Run Test with Coverage" should allow omitting files from the report. Ideally, honor the "omit" setting in the coverage configuration. Some default arguments may be set, such as .venv.

Compare also #24308.

Activity

  1. added
    feature-request
    on Oct 15, 2024
  2. added
    triage-needed
    on Oct 15, 2024
  3. bersbersbers commented on Oct 15, 2024

    @bersbersbers
    Author

    It seems this can be done using a workaround, namely, by using tool.coverage.run.omit (as opposed to tool.coverage.report.omit, which I tried previously).

    [tool.coverage.run]
    omit = [
        ".venv/*",
        # https://github.com/nedbat/coveragepy/issues/1392
        "pyscript",
        "shibokensupport/*",
        "signature_bootstrap.py",
    ]
    
  4. eleanorjboyd commented on Oct 30, 2024

    @eleanorjboyd

    seems related to this: #24366. Closing this one to group all the issues related to omitting from coverage in one issue.

  5. bersbersbers commented on Oct 31, 2024

    @bersbersbers
    Author

    Just for the record: this is a different issue than #24308 IMHO, related to the fact that omission of files can happen in at least two different places.

    In this issue, I don't really care which mechanism is used, as long as the files do not appear in the final report in the UI. In fact, the workaround mentioned in #24309 (comment) works fine for me. So I am fine with closing this issue.

    Just for completeness, in #24308, I care about error handling during the reporting phase, in case a file that exiting during run is missing during report.

  6. eleanorjboyd commented on Sep 16, 2025

    @eleanorjboyd

    Hi! I have tried this with both argument types in both .coveragerc and pyproject.toml and both work. Closing as I was unable to repro and looks like this is supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-testingfeature-requesttriage-needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions