From a1ed6839e38eecae809360f7641406aec3ba029b Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 17 May 2022 08:09:21 -0300 Subject: [PATCH] Refer to py.path.local instead of LEGACY_PATH constant for better docs --- .pre-commit-config.yaml | 2 +- src/_pytest/legacypath.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c5856cdd8..189aa5b91 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -101,7 +101,7 @@ repos: types: [python] - id: py-path-deprecated name: py.path usage is deprecated - exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py + exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py|src/_pytest/legacypath.py language: pygrep entry: \bpy\.path\.local types: [python] diff --git a/src/_pytest/legacypath.py b/src/_pytest/legacypath.py index ac23888c7..49149311a 100644 --- a/src/_pytest/legacypath.py +++ b/src/_pytest/legacypath.py @@ -270,7 +270,7 @@ class LegacyTestdirPlugin: @final @attr.s(init=False, auto_attribs=True) class TempdirFactory: - """Backward compatibility wrapper that implements :class:`_pytest.compat.LEGACY_PATH` + """Backward compatibility wrapper that implements :class:`py.path.local` for :class:`TempPathFactory`.""" _tmppath_factory: TempPathFactory @@ -282,11 +282,11 @@ class TempdirFactory: self._tmppath_factory = tmppath_factory def mktemp(self, basename: str, numbered: bool = True) -> LEGACY_PATH: - """Same as :meth:`TempPathFactory.mktemp`, but returns a ``_pytest.compat.LEGACY_PATH`` object.""" + """Same as :meth:`TempPathFactory.mktemp`, but returns a :class:`py.path.local` object.""" return legacy_path(self._tmppath_factory.mktemp(basename, numbered).resolve()) def getbasetemp(self) -> LEGACY_PATH: - """Backward compat wrapper for ``_tmppath_factory.getbasetemp``.""" + """Same as :meth:`TempPathFactory.getbasetemp`, but returns a :class:`py.path.local` object.""" return legacy_path(self._tmppath_factory.getbasetemp().resolve())