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

Function pytest_configure

src/_pytest/warnings.py:132–152  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

130
131
132def pytest_configure(config: Config) -> None:
133 with ExitStack() as stack:
134 stack.enter_context(
135 catch_warnings_for_item(
136 config=config,
137 ihook=config.hook,
138 when="config",
139 item=None,
140 # this disables recording because the terminalreporter has
141 # finished by the time it comes to reporting logged warnings
142 # from the end of config cleanup. So for now, this is only
143 # useful for setting a warning filter with an 'error' action.
144 record=False,
145 )
146 )
147 config.addinivalue_line(
148 "markers",
149 "filterwarnings(warning): add a warning filter to the given test. "
150 "see https://docs.pytest.org/en/stable/how-to/capture-warnings.html#pytest-mark-filterwarnings ",
151 )
152 config.add_cleanup(stack.pop_all().close)

Callers

nothing calls this directly

Calls 3

catch_warnings_for_itemFunction · 0.85
addinivalue_lineMethod · 0.80
add_cleanupMethod · 0.80

Tested by

no test coverage detected