MCPcopy
hub / github.com/pytest-dev/pytest / syspathinsert

Method syspathinsert

src/_pytest/pytester.py:909–921  ·  src/_pytest/pytester.py::Pytester.syspathinsert

Prepend a directory to sys.path, defaults to :attr:`path`. This is undone automatically when this object dies at the end of each test. :param path: The path.

(self, path: str | os.PathLike[str] | None = None)

Source from the content-addressed store, hash-verified

907 return self._makefile(class="st">".txt", args, kwargs)
908
909 def syspathinsert(self, path: str | os.PathLike[str] | None = None) -> None:
910 class="st">"""Prepend a directory to sys.path, defaults to :attr:`path`.
911
912 This is undone automatically when this object dies at the end of each
913 test.
914
915 :param path:
916 The path.
917 class="st">"""
918 if path is None:
919 path = self.path
920
921 self._monkeypatch.syspath_prepend(str(path))
922
923 def mkdir(self, name: str | os.PathLike[str]) -> Path:
924 class="st">"""Create a new (sub)directory.

Calls 1

syspath_prependMethod · 0.80

Tested by

no test coverage detected