Skip to content

regression in coverage 7.10.3: false negatives with patch=subprocess (# pragma: no branch is reported as not covered) #2073

@neutrinoceros

Description

@neutrinoceros

Describe the bug

context: I'm seeing what I believe are false negatives with coverage>7.10.2
xref: neutrinoceros/runtime-introspect#37

To Reproduce
The exact python version shouldn't matter (as long as it's 3.13 or newer)

git clone https://github.com/neutrinoceros/runtime-introspect@e309e37864437548623971a2d4cdc0d122b810b5
cd runtime-introspect
git checkout e309e37864437548623971a2d4cdc0d122b810b5 # latest commit at the time of writing
python -m venv
# ... source env ...
pip install -e . --group covcheck
coverage run -m pytest
coverage combine
coverage report

if you see tests/test_features.py:147 being reported as not covered, you have successfully reproduced this. The previous line starts with an if and is marked with a # pragma: no branch comment.
I bisected this regression to 697d4bb (coverage 7.10.3), and it appears to still be present in the development version.

Expected behavior
I expect line 147 to be omitted from reports. Versions 7.10.0 to 7.10.2 behave as I expect.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions