If a test is run again, the warning should still be raised
(self, pytester: Pytester)
| 353 | assert str(record[1].message) == "runtime" |
| 354 | |
| 355 | def test_double_test(self, pytester: Pytester) -> None: |
| 356 | """If a test is run again, the warning should still be raised""" |
| 357 | pytester.makepyfile( |
| 358 | """ |
| 359 | import pytest |
| 360 | import warnings |
| 361 | |
| 362 | @pytest.mark.parametrize('run', [1, 2]) |
| 363 | def test(run): |
| 364 | with pytest.warns(RuntimeWarning): |
| 365 | warnings.warn("runtime", RuntimeWarning) |
| 366 | """ |
| 367 | ) |
| 368 | result = pytester.runpytest() |
| 369 | result.stdout.fnmatch_lines(["*2 passed in*"]) |
| 370 | |
| 371 | def test_match_regex(self) -> None: |
| 372 | with pytest.warns(UserWarning, match=r"must be \d+$"): |
nothing calls this directly
no test coverage detected