parent
8b7f94f145
commit
8062743f6b
|
@ -0,0 +1 @@
|
||||||
|
:func:`pytest.deprecated_call` now also considers warnings of type :class:`FutureWarning`.
|
|
@ -56,7 +56,7 @@ def deprecated_call( # noqa: F811
|
||||||
def deprecated_call( # noqa: F811
|
def deprecated_call( # noqa: F811
|
||||||
func: Optional[Callable[..., Any]] = None, *args: Any, **kwargs: Any
|
func: Optional[Callable[..., Any]] = None, *args: Any, **kwargs: Any
|
||||||
) -> Union["WarningsRecorder", Any]:
|
) -> Union["WarningsRecorder", Any]:
|
||||||
"""Assert that code produces a ``DeprecationWarning`` or ``PendingDeprecationWarning``.
|
"""Assert that code produces a ``DeprecationWarning`` or ``PendingDeprecationWarning`` or ``FutureWarning``.
|
||||||
|
|
||||||
This function can be used as a context manager::
|
This function can be used as a context manager::
|
||||||
|
|
||||||
|
@ -82,7 +82,9 @@ def deprecated_call( # noqa: F811
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
if func is not None:
|
if func is not None:
|
||||||
args = (func,) + args
|
args = (func,) + args
|
||||||
return warns((DeprecationWarning, PendingDeprecationWarning), *args, **kwargs)
|
return warns(
|
||||||
|
(DeprecationWarning, PendingDeprecationWarning, FutureWarning), *args, **kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
|
|
|
@ -192,7 +192,7 @@ class TestDeprecatedCall:
|
||||||
f()
|
f()
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"warning_type", [PendingDeprecationWarning, DeprecationWarning]
|
"warning_type", [PendingDeprecationWarning, DeprecationWarning, FutureWarning]
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize("mode", ["context_manager", "call"])
|
@pytest.mark.parametrize("mode", ["context_manager", "call"])
|
||||||
@pytest.mark.parametrize("call_f_first", [True, False])
|
@pytest.mark.parametrize("call_f_first", [True, False])
|
||||||
|
@ -221,7 +221,6 @@ class TestDeprecatedCall:
|
||||||
UserWarning,
|
UserWarning,
|
||||||
SyntaxWarning,
|
SyntaxWarning,
|
||||||
RuntimeWarning,
|
RuntimeWarning,
|
||||||
FutureWarning,
|
|
||||||
ImportWarning,
|
ImportWarning,
|
||||||
UnicodeWarning,
|
UnicodeWarning,
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue