From 7a3644ac08ca1e47d55be8f196d4365d65aa7eeb Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 8 Oct 2022 09:54:21 -0300 Subject: [PATCH] [7.1.x] Add note in documentation to help modernize code bases to use pathlib --- doc/en/how-to/tmp_path.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/en/how-to/tmp_path.rst b/doc/en/how-to/tmp_path.rst index 99e9e5536..a2f936d33 100644 --- a/doc/en/how-to/tmp_path.rst +++ b/doc/en/how-to/tmp_path.rst @@ -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 ` :fixture:`tmpdir_factory ` API for details.