diff options
author | Ran Benita <ran@unusedvar.com> | 2020-06-25 14:08:47 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-06-25 14:30:42 +0300 |
commit | 4d813fdf5e258c634a428d5a8b14e3f4364f4bc1 (patch) | |
tree | 88bf7ae296b6686de01309398d04bbabca6bccaf /testing/test_recwarn.py | |
parent | f00bec2a12a585eee245284c8eac86edc27e661f (diff) | |
download | pytest-4d813fdf5e258c634a428d5a8b14e3f4364f4bc1.tar.gz |
recwarn: improve return type annotation of non-contextmanager pytest.warns
It returns the return value of the function.
Diffstat (limited to 'testing/test_recwarn.py')
-rw-r--r-- | testing/test_recwarn.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/testing/test_recwarn.py b/testing/test_recwarn.py index 1d445d1bf..f61f8586f 100644 --- a/testing/test_recwarn.py +++ b/testing/test_recwarn.py @@ -370,13 +370,14 @@ class TestWarns: @pytest.mark.filterwarnings("ignore") def test_can_capture_previously_warned(self) -> None: - def f(): + def f() -> int: warnings.warn(UserWarning("ohai")) return 10 assert f() == 10 assert pytest.warns(UserWarning, f) == 10 assert pytest.warns(UserWarning, f) == 10 + assert pytest.warns(UserWarning, f) != "10" # type: ignore[comparison-overlap] def test_warns_context_manager_with_kwargs(self) -> None: with pytest.raises(TypeError) as excinfo: |