MCPcopy Create free account
hub / github.com/pytest-dev/pytest / TempdirFactory

Class TempdirFactory

src/_pytest/legacypath.py:272–290  ·  view source on GitHub ↗

Backward compatibility wrapper that implements :class:``_pytest.compat.LEGACY_PATH`` for :class:``TempPathFactory``.

Source from the content-addressed store, hash-verified

270@final
271@attr.s(init=False, auto_attribs=True)
272class TempdirFactory:
273 """Backward compatibility wrapper that implements :class:``_pytest.compat.LEGACY_PATH``
274 for :class:``TempPathFactory``."""
275
276 _tmppath_factory: TempPathFactory
277
278 def __init__(
279 self, tmppath_factory: TempPathFactory, *, _ispytest: bool = False
280 ) -> None:
281 check_ispytest(_ispytest)
282 self._tmppath_factory = tmppath_factory
283
284 def mktemp(self, basename: str, numbered: bool = True) -> LEGACY_PATH:
285 """Same as :meth:`TempPathFactory.mktemp`, but returns a ``_pytest.compat.LEGACY_PATH`` object."""
286 return legacy_path(self._tmppath_factory.mktemp(basename, numbered).resolve())
287
288 def getbasetemp(self) -> LEGACY_PATH:
289 """Backward compat wrapper for ``_tmppath_factory.getbasetemp``."""
290 return legacy_path(self._tmppath_factory.getbasetemp().resolve())
291
292
293class LegacyTmpdirPlugin:

Callers 1

pytest_configureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected