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

Method test_strict_sanity

testing/test_skipping.py:613–626  ·  view source on GitHub ↗

Sanity check for xfail(strict=True): a failing test should behave exactly like a normal xfail.

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

611 result.stdout.fnmatch_lines([matchline])
612
613 def test_strict_sanity(self, pytester: Pytester) -> None:
614 """Sanity check for xfail(strict=True): a failing test should behave
615 exactly like a normal xfail."""
616 p = pytester.makepyfile(
617 """
618 import pytest
619 @pytest.mark.xfail(reason='unsupported feature', strict=True)
620 def test_foo():
621 assert 0
622 """
623 )
624 result = pytester.runpytest(p, "-rxX")
625 result.stdout.fnmatch_lines(["*XFAIL*", "*unsupported feature*"])
626 assert result.ret == 0
627
628 @pytest.mark.parametrize("strict", [True, False])
629 def test_strict_xfail(self, pytester: Pytester, strict: bool) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected