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

Method mkpydir

src/_pytest/pytester.py:936–945  ·  view source on GitHub ↗

Create a new python package. This creates a (sub)directory with an empty ``__init__.py`` file so it gets recognised as a Python package.

(self, name: str | os.PathLike[str])

Source from the content-addressed store, hash-verified

934 return p
935
936 def mkpydir(self, name: str | os.PathLike[str]) -> Path:
937 """Create a new python package.
938
939 This creates a (sub)directory with an empty ``__init__.py`` file so it
940 gets recognised as a Python package.
941 """
942 p = self.path / name
943 p.mkdir()
944 p.joinpath("__init__.py").touch()
945 return p
946
947 def copy_example(self, name: str | None = None) -> Path:
948 """Copy file from project's directory into the testdir.

Calls 1

mkdirMethod · 0.45

Tested by

no test coverage detected