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

Method syspathinsert

src/_pytest/pytester.py:892–903  ·  view source on GitHub ↗

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

(
        self, path: Optional[Union[str, "os.PathLike[str]"]] = None
    )

Source from the content-addressed store, hash-verified

890 return self._makefile(".txt", args, kwargs)
891
892 def syspathinsert(
893 self, path: Optional[Union[str, "os.PathLike[str]"]] = None
894 ) -> None:
895 """Prepend a directory to sys.path, defaults to :attr:`path`.
896
897 This is undone automatically when this object dies at the end of each
898 test.
899 """
900 if path is None:
901 path = self.path
902
903 self._monkeypatch.syspath_prepend(str(path))
904
905 def mkdir(self, name: str) -> Path:
906 """Create a new (sub)directory."""

Calls 1

syspath_prependMethod · 0.80

Tested by

no test coverage detected