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

Method test_xfail_raises

testing/test_skipping.py:598–611  ·  view source on GitHub ↗
(
        self, expected, actual, matchline, pytester: Pytester
    )

Source from the content-addressed store, hash-verified

596 ],
597 )
598 def test_xfail_raises(
599 self, expected, actual, matchline, pytester: Pytester
600 ) -> None:
601 p = pytester.makepyfile(
602 """
603 import pytest
604 @pytest.mark.xfail(raises=%s)
605 def test_raises():
606 raise %s()
607 """
608 % (expected, actual)
609 )
610 result = pytester.runpytest(p)
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

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected