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

pass or continue in else branch considered missing #497

Closed
nedbat opened this issue Jun 6, 2016 · 5 comments
Closed

pass or continue in else branch considered missing #497

nedbat opened this issue Jun 6, 2016 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@nedbat
Copy link
Owner

nedbat commented Jun 6, 2016

Originally reported by Peter Inglesby (Bitbucket: inglesp, GitHub: inglesp)


I would expect the following code to have 100% coverage, but it doesn't -- the continue line is marked as missing.

#!python

for n in [1, 2]:
    if n == 1:
        pass
    else:
        continue

The same happens if the continue is changed to pass. The contents of the if block is not important.

This may be a duplicate of #493 or #496.

I'm using coverage 4.1, and have reproduced with Pythons 3.5.1 and 2.7.10.

The contents of .coverage is:

!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/inglesp/coverage_demo.py": [1, 2, 3]}}

@nedbat
Copy link
Owner Author

nedbat commented Jun 7, 2016

It's a duplicate of #198, which is due to CPython optimizing away a jump to a jump.

@nedbat
Copy link
Owner Author

nedbat commented Jun 7, 2016

Duplicate of #198.

@nedbat
Copy link
Owner Author

nedbat commented Jun 7, 2016

Original comment by Peter Inglesby (Bitbucket: inglesp, GitHub: inglesp)


I think the limitation should be documented. If it's not already (I can't find it), would you welcome a patch?

@nedbat
Copy link
Owner Author

nedbat commented Jun 7, 2016

I suppose it could go here: http://coverage.readthedocs.io/en/coverage-4.1/trouble.html though I wonder if you would have found that page when looking?

@nedbat
Copy link
Owner Author

nedbat commented Jun 7, 2016

Original comment by Peter Inglesby (Bitbucket: inglesp, GitHub: inglesp)


Yes, I found that page.

@nedbat nedbat closed this as completed Jun 7, 2016
@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.1 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