Move temp dir retention explanation to end of fixture section

This commit is contained in:
faph 2024-01-17 12:48:25 +00:00
parent 406a22097d
commit 1019b5f67c
1 changed files with 5 additions and 5 deletions

View File

@ -11,11 +11,6 @@ The ``tmp_path`` fixture
You can use the ``tmp_path`` fixture which will provide a temporary directory You can use the ``tmp_path`` fixture which will provide a temporary directory
unique to each test function. unique to each test function.
By default, ``pytest`` retains the temporary directory for the last 3 ``pytest``
invocations. Concurrent invocations of the same test function are supported by
configuring the base temporary directory to be unique for each concurrent
run. See `temporary directory location and retention`_ for details.
``tmp_path`` is a :class:`pathlib.Path` object. Here is an example test usage: ``tmp_path`` is a :class:`pathlib.Path` object. Here is an example test usage:
.. code-block:: python .. code-block:: python
@ -66,6 +61,11 @@ Running this would result in a passed test except for the last
FAILED test_tmp_path.py::test_create_file - assert 0 FAILED test_tmp_path.py::test_create_file - assert 0
============================ 1 failed in 0.12s ============================= ============================ 1 failed in 0.12s =============================
By default, ``pytest`` retains the temporary directory for the last 3 ``pytest``
invocations. Concurrent invocations of the same test function are supported by
configuring the base temporary directory to be unique for each concurrent
run. See `temporary directory location and retention`_ for details.
.. _`tmp_path_factory example`: .. _`tmp_path_factory example`:
The ``tmp_path_factory`` fixture The ``tmp_path_factory`` fixture