Skip to content

Setting run.patch=["subprocess"] leads to run.omit being ignored #2047

@sigma67

Description

@sigma67

Describe the bug

So pytest-cov has recently removed their subprocess handling, which prompted me to try the suggested fix of enabling run.patch=["subprocess"] . Which did fix the issue.

However, this has now lead to all files that are being ignored via run.omit showing up as uncovered in the testreport.

This seems like quite an obvious bug so I might be missing something here.

I can specify the files again via --omit when running coverage report, but that seems to defeat the purpose of specifying them in pyproject.toml.

To Reproduce

Have some uncovered files which are excluded via run.omit in your src tree. Our config

[tool.coverage.run]
branch = true
source = ["src"]
omit = [
    "src/xx/xx/*.py",
    "src/xx/xx/xx/*.py",
    "src/xx/cli.py",
]
parallel = true
relative_files = true
# before we added the below patch, we had 100% coverage and omit files were excluded from report
patch = [
    "subprocess"
]

[tool.coverage.html]
show_contexts = true

[tool.coverage.report]
show_missing = true

Answer the questions below:

  1. What version of Python are you using?

We are testing on Python versions 3.10 - 3.13 and combining the results in the end for a final report.

  1. What version of coverage.py shows the problem? The output of coverage debug sys is helpful.

latest 7.10.6

  1. What versions of what packages do you have installed? The output of pip freeze is helpful.

pytest-cov 7.0
coverage 7.10.6

  1. What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix.

the specific code is not relevant

Expected behavior

omit should still work

Additional context

https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst#700-2025-09-09

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions