We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7692e30 commit 8ebf3a4Copy full SHA for 8ebf3a4
src/_pytest/recwarn.py
@@ -86,11 +86,12 @@ def deprecated_call(
86
__tracebackhide__ = True
87
# potential QoL: allow `with deprecated_call:` - i.e. no parens
88
dep_warnings = (DeprecationWarning, PendingDeprecationWarning, FutureWarning)
89
- if func is not None:
90
- warnings.warn(CALLABLE_DEPRECATED_CALL, stacklevel=2)
91
- with warns(dep_warnings):
92
- return func(*args, **kwargs)
93
- return warns(dep_warnings, *args, **kwargs)
+ if func is None:
+ return warns(dep_warnings, *args, **kwargs)
+
+ warnings.warn(CALLABLE_DEPRECATED_CALL, stacklevel=2)
+ with warns(dep_warnings):
94
+ return func(*args, **kwargs)
95
96
97
@overload
0 commit comments