-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fixed#2684: use the correct stacklevel for deprecation warnings #2689
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ def extract_from(cls, parameterset, legacy_force_tuple=False): | |
argval = argval, | ||
|
||
if newmarks: | ||
warnings.warn(MARK_PARAMETERSET_UNPACKING) | ||
warnings.warn(MARK_PARAMETERSET_UNPACKING, stacklevel=2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in this case stacklevel is also not usable, its a case where its probably more sensible to warn explicit and pass the test around |
||
|
||
return cls(argval, marks=newmarks, id=None) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -919,7 +919,7 @@ def _idval(val, argname, idx, idfn, config=None): | |
import warnings | ||
msg = "Raised while trying to determine id of parameter %s at position %d." % (argname, idx) | ||
msg += '\nUpdate your code as this will raise an error in pytest-4.0.' | ||
warnings.warn(msg, DeprecationWarning) | ||
warnings.warn(msg, DeprecationWarning, stacklevel=2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for this one stacklevel is actually not applicable |
||
if s: | ||
return _ascii_escaped(s) | ||
|
||
|
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.
this change looks incorrect, the argument type is used indirectly and the higher level intended to trigger that warning for the method call side