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

branch coverage: "if" before "if False" marked as partial wrongly #598

Closed
nedbat opened this issue Aug 24, 2017 · 3 comments
Closed

branch coverage: "if" before "if False" marked as partial wrongly #598

nedbat opened this issue Aug 24, 2017 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@nedbat
Copy link
Owner

nedbat commented Aug 24, 2017

Originally reported by Daniel Hahler (Bitbucket: blueyed, GitHub: blueyed)


The following code is considered to be 100% covered, which might be related to https://bitbucket.org/ned/coveragepy/issues/198/continue-marked-as-not-covered (i.e. line 6 should be marked as missed, but is not due to optimization?!):

for a in [True, False]:
    if a:
        print(1)

    if False:
        print(0)

However, when using branch = True, line 2 gets marked as "partial" in the html report, although line 5 should be marked as such instead.

Name         Stmts   Miss Branch BrPart  Cover   Missing
--------------------------------------------------------
t-cov-2.py       4      0      4      1    88%   2->5

Python 3.6.2
coverage.py 4.4.1


@nedbat
Copy link
Owner Author

nedbat commented Aug 24, 2017

Thanks, I'll have to dig into this, but it might take a while.

@nedbat
Copy link
Owner Author

nedbat commented Oct 21, 2017

This is a duplicate of #198, in that the peephole optimizer has removed logical code paths from execution. Coverage cannot recreate the original paths.

@nedbat
Copy link
Owner Author

nedbat commented Oct 21, 2017

Duplicate of #198.

@nedbat nedbat closed this as completed Oct 21, 2017
@nedbat nedbat added major bug Something isn't working labels Jun 23, 2018
@nedbat nedbat added duplicate This issue or pull request already exists and removed 4.4 bug Something isn't working labels Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

1 participant