feat: 10865 add test with valid warning

This commit is contained in:
Volodymyr Kochetkov 2024-01-28 15:41:10 +02:00
parent d314ea6c77
commit 9c4ffb5207
1 changed files with 6 additions and 0 deletions

View File

@ -487,6 +487,12 @@ def test_raise_type_error_on_non_string_warning() -> None:
warnings.warn(1) # type: ignore
def test_no_raise_type_error_on_string_warning() -> None:
"""Check pytest.warns validates warning messages are strings (#10865)."""
with pytest.warns(UserWarning):
warnings.warn("Warning")
@pytest.mark.skipif(
hasattr(sys, "pypy_version_info"),
reason="Not for pypy",