-
Notifications
You must be signed in to change notification settings - Fork 124
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
Adjust stacklevel of implprefix warning #181
Adjust stacklevel of implprefix warning #181
Conversation
6aed39b
to
98c3974
Compare
98c3974
to
bee289c
Compare
The build is failing due to a recent change in pytest which adds a wrapper for |
@crazymerlyn thanks for the PR 👍! |
Oh indeed, good catch. What do you think @asottile? |
oh! I see what you're saying now -- I was wracking my brain to figure out what was meant here. if isinstance(kwargs.get('stacklevel'), int):
kwargs['stacklevel'] += 1 might be safer probably PR that to pytest and we can get it into 3.9.2? |
Yeah, that seems better. But while we are on this, I think stacklevel also needs to be changed if it is not present in kwargs. The default value is 1. So, if somebody uses recwarn in python2.7, the warning will present itself at the wrapper function rather than the line causing the warning. if isinstance(kwargs.get('stacklevel'), int):
kwargs['stacklevel'] += 1
elif 'stacklevel' not in kwargs:
kwargs['stacklevel'] = 2 |
ah in that case even easier: kwargs.setdefault('stacklevel', 1)
kwargs['stacklevel'] += 1 |
So, I tried adding this change to a PR but got a few errors with |
hmm yeah this is probably the |
Heh, that's all good and part of the game 😁 |
not pretty, but at least this is throwaway :'( pytest-dev/pytest#4192 |
sorry about the trouble again, thanks for the report! 🎉 |
@nicoddemus good to go here yah? |
yah! |
Many thanks! |
Fixes #166.