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

Function pytest_configure

src/_pytest/skipping.py:50–86  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

48
49
50def pytest_configure(config: Config) -> None:
51 if config.option.runxfail:
52 # yay a hack
53 import pytest
54
55 old = pytest.xfail
56 config.add_cleanup(lambda: setattr(pytest, "xfail", old))
57
58 def nop(*args, **kwargs):
59 pass
60
61 nop.Exception = xfail.Exception # type: ignore[attr-defined]
62 setattr(pytest, "xfail", nop)
63
64 config.addinivalue_line(
65 "markers",
66 "skip(reason=None): skip the given test function with an optional reason. "
67 'Example: skip(reason="no way of currently testing this") skips the '
68 "test.",
69 )
70 config.addinivalue_line(
71 "markers",
72 "skipif(condition, ..., *, reason=...): "
73 "skip the given test function if any of the conditions evaluate to True. "
74 "Example: skipif(sys.platform == 'win32') skips the test if we are on the win32 platform. "
75 "See https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-skipif",
76 )
77 config.addinivalue_line(
78 "markers",
79 "xfail(condition, ..., *, reason=..., run=True, raises=None, strict=strict_xfail): "
80 "mark the test function as an expected failure if any of the conditions "
81 "evaluate to True. Optionally specify a reason for better reporting "
82 "and run=False if you don't even want to execute the test function. "
83 "If only specific exception(s) are expected, you can list them in "
84 "raises, and if the test fails in other ways, it will be reported as "
85 "a true failure. See https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-xfail",
86 )
87
88
89def evaluate_condition(item: Item, mark: Mark, condition: object) -> tuple[bool, str]:

Callers

nothing calls this directly

Calls 2

add_cleanupMethod · 0.80
addinivalue_lineMethod · 0.80

Tested by

no test coverage detected