MCPcopy
hub / github.com/pytest-dev/pytest / test_xfail_xpassed_strict

Method test_xfail_xpassed_strict

testing/test_skipping.py:344–358  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

342 assert callreport.wasxfail
343
344 def test_xfail_xpassed_strict(self, pytester: Pytester) -> None:
345 item = pytester.getitem(
346 """
347 import pytest
348 @pytest.mark.xfail(strict=True, reason="nope")
349 def test_func():
350 assert 1
351 """
352 )
353 reports = runtestprotocol(item, log=False)
354 assert len(reports) == 3
355 callreport = reports[1]
356 assert callreport.failed
357 assert str(callreport.longrepr) == "[XPASS(strict)] nope"
358 assert not hasattr(callreport, "wasxfail")
359
360 def test_xfail_run_anyway(self, pytester: Pytester) -> None:
361 pytester.makepyfile(

Callers

nothing calls this directly

Calls 2

runtestprotocolFunction · 0.90
getitemMethod · 0.45

Tested by

no test coverage detected