Skip to content

Commit b6c3cd3

Browse files
committed
fix tests. And stop the decorator from erroring cause idk why it did
1 parent 358e367 commit b6c3cd3

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/_pytest/deprecated.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@
2727
else:
2828

2929
def deprecated(reason: str = "") -> object:
30-
raise AssertionError(
31-
"This decorator should only be used to indicate that overloads are deprecated"
32-
)
33-
# once py<3.13 is no longer supported, or when somebody wants to use decorators
34-
# to deprecated, we can consider adapting this function to raise warnings
35-
# at runtime
30+
# This decorator should only be used to indicate that overloads are deprecated
31+
# once py<3.13 is no longer supported, or when somebody wants to use @deprecated
32+
# for runtime warning, we can consider adapting this decorator to support that
33+
def decorator(func: object) -> object:
34+
return func
35+
36+
return decorator
3637

3738

3839
CALLABLE_RAISES = PytestPendingDeprecationWarning(

testing/test_recwarn.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,11 @@ def test_deprecated_call_ret(self) -> None:
164164
PytestPendingDeprecationWarning,
165165
match=(
166166
wrap_escape(
167-
"The callable form of pytest.deprecated_call is deprecated.\n"
167+
"The callable form of pytest.deprecated_call will be deprecated in a future version.\n"
168168
"Use `with pytest.deprecated_call():` instead."
169+
"Full deprecation will not be made until there's a tool to automatically update"
170+
" code to use the context-manager form.\n"
171+
"See https://docs.pytest.org/en/stable/reference/deprecations.html#legacy-callable-form-of-raises-warns-and-deprecated-call"
169172
)
170173
),
171174
):
@@ -297,8 +300,11 @@ def test_function(self) -> None:
297300
PytestPendingDeprecationWarning,
298301
match=(
299302
wrap_escape(
300-
"The callable form of pytest.warns is deprecated.\n"
303+
"The callable form of pytest.warns will be deprecated in a future version.\n"
301304
"Use `with pytest.warns(...):` instead."
305+
"Full deprecation will not be made until there's a tool to automatically update"
306+
" code to use the context-manager form.\n"
307+
"See https://docs.pytest.org/en/stable/reference/deprecations.html#legacy-callable-form-of-raises-warns-and-deprecated-call"
302308
)
303309
),
304310
):

0 commit comments

Comments
 (0)