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

Function xfail

src/_pytest/outcomes.py:241–252  ·  view source on GitHub ↗

Imperatively xfail an executing test or setup function with the given reason. This function should be called only during testing (setup, call or teardown). .. note:: It is better to use the :ref:`pytest.mark.xfail ref` marker when possible to declare a test to be xfailed un

(reason: str = "")

Source from the content-addressed store, hash-verified

239
240@_with_exception(XFailed)
241def xfail(reason: str = "") -> "NoReturn":
242 """Imperatively xfail an executing test or setup function with the given reason.
243
244 This function should be called only during testing (setup, call or teardown).
245
246 .. note::
247 It is better to use the :ref:`pytest.mark.xfail ref` marker when
248 possible to declare a test to be xfailed under certain conditions
249 like known bugs or missing features.
250 """
251 __tracebackhide__ = True
252 raise XFailed(reason)
253
254
255def importorskip(

Callers 3

pytest_runtest_setupFunction · 0.90
pytest_runtest_callFunction · 0.90
addExpectedFailureMethod · 0.90

Calls 1

XFailedClass · 0.85

Tested by 1

addExpectedFailureMethod · 0.72