| 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+$"): |
| 373 | warnings.warn("value must be 42", UserWarning) |
| 374 | |
| 375 | with pytest.raises(pytest.fail.Exception): |
| 376 | with pytest.warns(UserWarning, match=r"must be \d+$"): |
| 377 | warnings.warn("this is not here", UserWarning) |
| 378 | |
| 379 | with pytest.raises(pytest.fail.Exception): |
| 380 | with pytest.warns(FutureWarning, match=r"must be \d+$"): |
| 381 | warnings.warn("value must be 42", UserWarning) |
| 382 | |
| 383 | def test_one_from_multiple_warns(self) -> None: |
| 384 | with pytest.warns(UserWarning, match=r"aaa"): |