doc: add note to help modernize code bases to use pathlib

Fixes #10199
This commit is contained in:
Samuel Gaist 2022-10-01 11:44:06 +02:00
parent 3c1534944c
commit a28d595b46
No known key found for this signature in database
GPG Key ID: 597C200C2BCB5987
1 changed files with 11 additions and 0 deletions

View File

@ -109,6 +109,17 @@ rather than standard :class:`pathlib.Path` objects.
.. note::
These days, it is preferred to use ``tmp_path`` and ``tmp_path_factory``.
In order to help modernize old code bases, one can run pytest with the legacypath
plugin disabled:
.. code-block:: bash
pytest -p no:legacypath
This will trigger errors on tests using the legacy paths.
It can also be permanently set as part of the :confval:`addopts` parameter in the
config file.
See :fixture:`tmpdir <tmpdir>` :fixture:`tmpdir_factory <tmpdir_factory>`
API for details.