Skip to content

Commit 6a25660

Browse files
Docs: Note lifetime of temporary directories
Explanation: The default handling of these lifetimes is done in `tmpdir.TempPathFactory.getbasetemp`, which passes `keep=3` to `pathlib.make_numbered_dir_with_cleanup`. GH Issue: #8036
1 parent 3405c7e commit 6a25660

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/_pytest/tmpdir.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ def tmpdir(tmp_path: Path) -> py.path.local:
174174
function invocation, created as a sub directory of the base temporary
175175
directory.
176176
177+
By default, a new base temporary directory is created each test session,
178+
and old bases are removed after 3 sessions, to aid in debugging. If
179+
``--basetemp`` is used then it is cleared each session. See :ref:`base
180+
temporary directory`.
181+
177182
The returned object is a `py.path.local`_ path object.
178183
179184
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
@@ -187,6 +192,11 @@ def tmp_path(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Path
187192
function invocation, created as a sub directory of the base temporary
188193
directory.
189194
195+
By default, a new base temporary directory is created each test session,
196+
and old bases are removed after 3 sessions, to aid in debugging. If
197+
``--basetemp`` is used then it is cleared each session. See :ref:`base
198+
temporary directory`.
199+
190200
The returned object is a :class:`pathlib.Path` object.
191201
"""
192202

0 commit comments

Comments
 (0)