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

Function tmp_path

src/_pytest/tmpdir.py:198–211  ·  view source on GitHub ↗

Return a temporary directory path object which is unique to each test function invocation, created as a sub directory of the base temporary directory. By default, a new base temporary directory is created each test session, and old bases are removed after 3 sessions, to aid in debug

(request: FixtureRequest, tmp_path_factory: TempPathFactory)

Source from the content-addressed store, hash-verified

196
197@fixture
198def tmp_path(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Path:
199 """Return a temporary directory path object which is unique to each test
200 function invocation, created as a sub directory of the base temporary
201 directory.
202
203 By default, a new base temporary directory is created each test session,
204 and old bases are removed after 3 sessions, to aid in debugging. If
205 ``--basetemp`` is used then it is cleared each session. See :ref:`base
206 temporary directory`.
207
208 The returned object is a :class:`pathlib.Path` object.
209 """
210
211 return _mk_tmp(request, tmp_path_factory)

Callers

nothing calls this directly

Calls 1

_mk_tmpFunction · 0.85

Tested by

no test coverage detected