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

Method test_import_after

testing/test_pathlib.py:285–296  ·  testing/test_pathlib.py::TestImportPath.test_import_after
(self, tmp_path: Path, ns_param: bool)

Source from the content-addressed store, hash-verified

283 assert mod.value2 == class="st">"got it"
284
285 def test_import_after(self, tmp_path: Path, ns_param: bool) -> None:
286 tmp_path.joinpath(class="st">"xxxpackage").mkdir()
287 tmp_path.joinpath(class="st">"xxxpackage", class="st">"__init__.py").touch()
288 mod1path = tmp_path.joinpath(class="st">"xxxpackage", class="st">"module1.py")
289 mod1path.touch()
290 mod1 = import_path(
291 mod1path, root=tmp_path, consider_namespace_packages=ns_param
292 )
293 assert mod1.__name__ == class="st">"xxxpackage.module1"
294 from xxxpackage import module1
295
296 assert module1 is mod1
297
298 def test_check_filepath_consistency(
299 self, monkeypatch: MonkeyPatch, tmp_path: Path, ns_param: bool

Callers

nothing calls this directly

Calls 2

import_pathFunction · 0.90
mkdirMethod · 0.45

Tested by

no test coverage detected