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)
| 196 | |
| 197 | @fixture |
| 198 | def 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) |