-
-
Notifications
You must be signed in to change notification settings - Fork 440
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
Generator expression is marked as not executed when it clearly is #475
Comments
This is from http://stackoverflow.com/questions/35317757/python-unittest-branch-coverage-seems-to-miss-executed-generator-in-zip There, the problem was correctly identified: zip never exhausts the second iterator, because it stops as soon as the first iterator is done. So the second generator never got a chance to finish, so 3->-3 is missing. I would like to do a better job here, especially because work is underway to make 3->-3 be expressed as, "The generator expression on line 3 never ran," which is not true. |
Fixed in 7a3950c9c967 (bb). Now a line might be marked as "The generator on line 3 never ran" or "The generator on line 3 never finished." |
I recently ran into this, and had some additional questions: How can we denote a case where not finishing the iterator is the intended outcome? For instance, Coverage.py flags this:
Then, if not exhausting an iterator is a "failure" of coverage, why is there no complaint about this substitute? Coverage.py does not flag this:
The Python docs say explicitly that In terms of getting around it, |
@ipmcc The filter isn't getting flagged because the loop is hidden inside the |
This just happened to me using |
In this code with branch coverage, "Line of interest" is marked as partial (3->-3)
Happens with 4.0.3 and 4.1b2+
The text was updated successfully, but these errors were encountered: