-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression on branch coverage in 7.6.2 #1876
Comments
We're seeing the same thing with this code: https://github.com/pyca/cryptography/blob/main/tests/x509/test_name.py#L17-L27 https://github.com/pyca/cryptography/actions/runs/11273274929/job/31350177576 shows the coverage output (26->18 is uncovered) |
Experiencing this well. I additionally noticed that the branch coverage is only missing on the last of the nested context managers. Extending @ziima's example: from unittest import TestCase
from contextlib import suppress
class CoverageTest(TestCase):
def test_coverage(self):
with suppress(ValueError):
# Covered correctly
with suppress(ValueError):
pass
# Covered correctly
with suppress(ValueError):
pass
# Missing branch here:
with suppress(ValueError):
pass
expected = (
tuple(b"<content_1>"),
) I also encountered the issue when the context manager is the last line in the test function, even though removing the |
Thanks for the clear test cases. This is fixed in commit 378c321. |
Thanks Ned! |
This is now released as part of coverage 7.6.3. |
Describe the bug
We discovered a regression in branch coverage of nested context processors in 7.6.2.
To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
Affected are 3.10 and 3.11
coverage debug sys
is helpful.7.6.2
pip freeze
is helpful.git clone
,pip install
, and so on. Explain like we're five!Actual behavior
Expected behavior
100% coverage
Additional context
Report is fine in:
The branch coverage is highly dependent on the exact code. The missing branch also disappears if the
expected
is reformatted to a single line.The text was updated successfully, but these errors were encountered: