MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_option_precedence_mark

Function test_option_precedence_mark

testing/test_warnings.py:410–427  ·  view source on GitHub ↗

Filters defined by marks should always take precedence (#3946).

(pytester: Pytester)

Source from the content-addressed store, hash-verified

408
409
410def 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
430class TestDeprecationWarningsByDefault:

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
makeiniMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected