Skip to content

Commit 1a1bb61

Browse files
authored
Merge pull request #8038 from matthewhughes934/note-tmpdir-lifetime
Docs: Note lifetime of temporary directories
2 parents e398c93 + 6a25660 commit 1a1bb61

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
@@ -199,6 +199,11 @@ def tmpdir(tmp_path: Path) -> py.path.local:
199199
function invocation, created as a sub directory of the base temporary
200200
directory.
201201
202+
By default, a new base temporary directory is created each test session,
203+
and old bases are removed after 3 sessions, to aid in debugging. If
204+
``--basetemp`` is used then it is cleared each session. See :ref:`base
205+
temporary directory`.
206+
202207
The returned object is a `py.path.local`_ path object.
203208
204209
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
@@ -212,6 +217,11 @@ def tmp_path(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Path
212217
function invocation, created as a sub directory of the base temporary
213218
directory.
214219
220+
By default, a new base temporary directory is created each test session,
221+
and old bases are removed after 3 sessions, to aid in debugging. If
222+
``--basetemp`` is used then it is cleared each session. See :ref:`base
223+
temporary directory`.
224+
215225
The returned object is a :class:`pathlib.Path` object.
216226
"""
217227

0 commit comments

Comments
 (0)