-
Notifications
You must be signed in to change notification settings - Fork 33
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
Weird failure with pytest and multiline assert #61
Comments
I will try to reproduce it later in some executing tests. |
I reduced the problem to the following code, which is reproducible without icecream. from executing import Source
import inspect
print("\n\nFirst bug")
print(Source.executing(inspect.currentframe()).node)
def test_icecream_fine():
print("No bug")
print(Source.executing(inspect.currentframe()).node)
assert (True)
1
def test_icecream_also_fine():
print("No bug")
print(Source.executing(inspect.currentframe()).node)
assert (True
)
def test_icecream_bug():
print("Second bug")
print(Source.executing(inspect.currentframe()).node)
assert (True # this linebreak is important
)
1 # this is also important output
Can this line have something to do with this behaviour? executing/executing/executing.py Lines 884 to 888 in 32c2388
I don't know how the SentinelNodeFinder works. Any hints? |
The previous code checked for Theory:
|
That line is saying to be less strict about things being the same in the presence of pytest. Detecting pytest should make it more likely to find the node, not less.
Look at the change in 777ee37, particularly the previous code: self.is_pytest = any(
'pytest' in name.lower()
for group in [code.co_names, code.co_varnames]
for name in group
) It wasn't "is pytest mentioned in the source code", it was whether it was in any of the variable names. In particular that was meant to also include the names created by pytest magic. When I Anyway, when I run either your example or the icecream one on my machine, I only get the first bug, not the second. This is with both Python 3.8.5 and 3.11, and with pytest 7.2.0. |
You are right, I use python 3.10.0 and pytest 7.2.0 |
Right, I also see the failure in 3.10. Things went bad in 3.10, some optimisations were added that were very hard to handle. If #42 ever happens it might help. I see that |
See gruns/icecream#134
@15r10nk not sure if this is related to your recent work
The text was updated successfully, but these errors were encountered: