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

Function pytest_configure

src/_pytest/tmpdir.py:244–254  ·  view source on GitHub ↗

Create a TempPathFactory and attach it to the config object. This is to comply with existing plugins which expect the handler to be available at pytest_configure time, but ideally should be moved entirely to the tmp_path_factory session fixture.

(config: Config)

Source from the content-addressed store, hash-verified

242
243
244def pytest_configure(config: Config) -> None:
245 """Create a TempPathFactory and attach it to the config object.
246
247 This is to comply with existing plugins which expect the handler to be
248 available at pytest_configure time, but ideally should be moved entirely
249 to the tmp_path_factory session fixture.
250 """
251 mp = MonkeyPatch()
252 config.add_cleanup(mp.undo)
253 _tmp_path_factory = TempPathFactory.from_config(config, _ispytest=True)
254 mp.setattr(config, "_tmp_path_factory", _tmp_path_factory, raising=False)
255
256
257def pytest_addoption(parser: Parser) -> None:

Callers

nothing calls this directly

Calls 4

setattrMethod · 0.95
MonkeyPatchClass · 0.90
add_cleanupMethod · 0.80
from_configMethod · 0.45

Tested by

no test coverage detected