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

Method basedir

testing/test_conftest.py:46–59  ·  view source on GitHub ↗
(self, request, tmp_path_factory: TempPathFactory)

Source from the content-addressed store, hash-verified

44class TestConftestValueAccessGlobal:
45 @pytest.fixture(scope="module", params=["global", "inpackage"])
46 def basedir(self, request, tmp_path_factory: TempPathFactory) -> Generator[Path]:
47 tmp_path = tmp_path_factory.mktemp("basedir", numbered=True)
48 tmp_path.joinpath("adir/b").mkdir(parents=True)
49 tmp_path.joinpath("adir/conftest.py").write_text(
50 "a=1 ; Directory = 3", encoding="utf-8"
51 )
52 tmp_path.joinpath("adir/b/conftest.py").write_text(
53 "b=2 ; a = 1.5", encoding="utf-8"
54 )
55 if request.param == "inpackage":
56 tmp_path.joinpath("adir/__init__.py").touch()
57 tmp_path.joinpath("adir/b/__init__.py").touch()
58
59 yield tmp_path
60
61 def test_basic_init(self, basedir: Path) -> None:
62 conftest = PytestPluginManager()

Callers

nothing calls this directly

Calls 3

write_textMethod · 0.80
mktempMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected