Filters defined by marks should always take precedence (#3946).
(pytester: Pytester)
| 408 | |
| 409 | |
| 410 | def test_option_precedence_mark(pytester: Pytester) -> None: |
| 411 | """Filters defined by marks should always take precedence (#3946).""" |
| 412 | pytester.makeini( |
| 413 | """ |
| 414 | [pytest] |
| 415 | filterwarnings = ignore |
| 416 | """ |
| 417 | ) |
| 418 | pytester.makepyfile( |
| 419 | """ |
| 420 | import pytest, warnings |
| 421 | @pytest.mark.filterwarnings('error') |
| 422 | def test(): |
| 423 | warnings.warn(UserWarning('hello')) |
| 424 | """ |
| 425 | ) |
| 426 | result = pytester.runpytest("-W", "ignore") |
| 427 | result.stdout.fnmatch_lines(["* 1 failed in*"]) |
| 428 | |
| 429 | |
| 430 | class TestDeprecationWarningsByDefault: |
nothing calls this directly
no test coverage detected