-
Notifications
You must be signed in to change notification settings - Fork 591
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
Fix deprecation warning stacklevel #1610
Conversation
record, = log | ||
# We got the warning we expected, from the right file | ||
assert isinstance(record.message, HypothesisDeprecationWarning) | ||
assert record.message.args == ('message',) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpick: Maybe change 'message'
to something more distinctive, just to make it abundantly clear to the reader that this is a placeholder message that should match the one used in the strategy above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Never mind, I want to personally understand the problem more before I approve this.
stacklevel=3 used to point at the call site in user code, but now points into the lazy reification machinery.
f6f0f1e
to
8343c64
Compare
No worries! Changing the filter to |
So, as I understand it:
Strictly speaking this doesn't “fix” #652, but at least it's now not-fixed in a sensible way, instead of a completely baffling way, which is an improvement. |
Yep, that's all correct - I'm not sure there are any cases left where |
In that case, I'm satisfied that this patch makes sense and is an improvement. (It would be nice to restore user-code stack traces in the cases where that's possible, but such work would be well beyond the scope of this PR.) |
🎉 For what it's worth, #1582 will point back to user code for anyone running with warnings as errors! |
stacklevel=3
used to point at the call site in user code, but now points into the lazy reification machinery. Changing that tostacklevel=2
points it back at the call tonote_deprecation
, which is still useful.Closes #652.