|
1 | 1 | # mypy: allow-untyped-defs
|
2 |
| -import sys |
3 | 2 | import warnings
|
4 | 3 | from typing import List
|
5 | 4 | from typing import Optional
|
@@ -478,29 +477,3 @@ def test_catch_warning_within_raise(self) -> None:
|
478 | 477 | with pytest.raises(ValueError, match="some exception"):
|
479 | 478 | warnings.warn("some warning", category=FutureWarning)
|
480 | 479 | raise ValueError("some exception")
|
481 |
| - |
482 |
| - |
483 |
| -def test_raise_type_error_on_non_string_warning() -> None: |
484 |
| - """Check pytest.warns validates warning messages are strings (#10865).""" |
485 |
| - with pytest.raises(TypeError, match="Warning message must be str"): |
486 |
| - with pytest.warns(UserWarning): |
487 |
| - warnings.warn(1) # type: ignore |
488 |
| - |
489 |
| - |
490 |
| -def test_no_raise_type_error_on_string_warning() -> None: |
491 |
| - """Check pytest.warns validates warning messages are strings (#10865).""" |
492 |
| - with pytest.warns(UserWarning): |
493 |
| - warnings.warn("Warning") |
494 |
| - |
495 |
| - |
496 |
| -@pytest.mark.skipif( |
497 |
| - hasattr(sys, "pypy_version_info"), |
498 |
| - reason="Not for pypy", |
499 |
| -) |
500 |
| -def test_raise_type_error_on_non_string_warning_cpython() -> None: |
501 |
| - # Check that we get the same behavior with the stdlib, at least if filtering |
502 |
| - # (see https://github.com/python/cpython/issues/103577 for details) |
503 |
| - with pytest.raises(TypeError): |
504 |
| - with warnings.catch_warnings(): |
505 |
| - warnings.filterwarnings("ignore", "test") |
506 |
| - warnings.warn(1) # type: ignore |
0 commit comments