Refer to py.path.local instead of LEGACY_PATH constant for better docs

This commit is contained in:
Bruno Oliveira 2022-05-17 08:09:21 -03:00
parent 296b642eb3
commit a1ed6839e3
2 changed files with 4 additions and 4 deletions

View File

@ -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]

View File

@ -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())