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

Function pytest_configure

src/_pytest/tmpdir.py:169–179  ·  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

167
168
169def pytest_configure(config: Config) -> None:
170 """Create a TempPathFactory and attach it to the config object.
171
172 This is to comply with existing plugins which expect the handler to be
173 available at pytest_configure time, but ideally should be moved entirely
174 to the tmp_path_factory session fixture.
175 """
176 mp = MonkeyPatch()
177 config.add_cleanup(mp.undo)
178 _tmp_path_factory = TempPathFactory.from_config(config, _ispytest=True)
179 mp.setattr(config, "_tmp_path_factory", _tmp_path_factory, raising=False)
180
181
182@fixture(scope="session")

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