-
-
Notifications
You must be signed in to change notification settings - Fork 448
branch coverage of with statement in 2.7 #128
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
Comments
Original comment by Christian Heimes (Bitbucket: tiran, GitHub: tiran) The problem could be caused by a change in Python 2.7's context protocol. Since 2.7 the enter and exit methods are looked up on the type rather than on the object. The lookup is done in the new opcode SETUP_WITH. Python 2.7 dis
Python 2.6 dis
|
Turns out this was fixed in <<changeset 52789af288d1 (bb)>>, and discovered as tested in <<changeset de3815101d3d (bb)>>. |
Original comment by Gre7g Luterman (Bitbucket: gre7g, GitHub: gre7g) I'm experiencing this issue too. Coverage 3.6, tried both Python 2.6 and Python 2.7 and had the same results. Screenshot: http://screencast.com/t/SRFFWkwFyHAU |
@gre7g: This issue is marked as resolved, can you provide a sample that demonstrates it still happening? Even if you can just point to an open source project with runnable tests that show it happening? Notice that the original problem report mentioned a return statement inside a with statement, which is not how your code is structured. |
…ty bytes object (nedbat#136) Closes nedbat#128.
Originally reported by Christian Heimes (Bitbucket: tiran, GitHub: tiran)
With Python 2.7, branch detection doesn't get a with statement right with an inner return right. Coverage show the line "with open("test", "w") as f" as a branch, that never reaches "exit". Under Python 2.6 the with statement is shown as fully covered.
Tested with coverage 3.4 and 3.5a1.
The text was updated successfully, but these errors were encountered: