Skip to content
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

Coverage regressions for "with" statement on CPython 3.10 #1211

Closed
skirpichev opened this issue Aug 12, 2021 · 1 comment
Closed

Coverage regressions for "with" statement on CPython 3.10 #1211

skirpichev opened this issue Aug 12, 2021 · 1 comment
Labels
bug Something isn't working fixed

Comments

@skirpichev
Copy link

Per request I've opened a separate issue.

There are regressions in the diofant/integrals/rde.py on lines with the "with" statement (e.g. L309 and L546). On the CPython 3.9 & the latest coveragepy release - these lines are marked as covered.

To reproduce issue, install the diofant e.g. with pip install -e .[develop] in the git tree, install pytest and coveragepy from git (I use coveragepy at 57a691f) and run:

pytest -n0 -m 'not slow and not xfail and not regression' --cov diofant \
    diofant/tests/integrals/test_rde.py diofant/tests/integrals/test_risch.py
coverage html

Here are two examples (there are four such "with" statements). The function bound_degree():
1

The function cancel_primitive():
2

The first one you may view as a new "feature" of the coveragepy. But not too helpful, as it looks for me, since L320 and L342 (i.e. ValueError exceptions) were marked as uncovered before. Maybe it's a documentation issue: how works the branch coverage here - seems unclear for me (wrt "if" statements, for example). For instance, why there are (and on L546) 3 branches:

<line number="309" hits="1" branch="true" condition-coverage="66% (2/3)" missing-branches="exit"/>
<line number="546" hits="1" branch="true" condition-coverage="66% (2/3)" missing-branches="exit"/>

But the second example looks definitely wrong. The NotImplementedError on L552 is ignored by the coveragepy configuration. I think, then this "branch" of the "with" statement on L546 - should be ignored too (as it happens for if/elif/else statements).

@skirpichev skirpichev added the bug Something isn't working label Aug 12, 2021
@nedbat
Copy link
Owner

nedbat commented Aug 14, 2021

Thanks. This was coverage.py being over-zealous about warning about missed branches. I've fixed it in commit f6d3e88.

@nedbat nedbat closed this as completed Aug 14, 2021
@nedbat nedbat added the fixed label Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants