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

Method simple_module

testing/test_pathlib.py:349–358  ·  view source on GitHub ↗
(
        self, tmp_path: Path, request: pytest.FixtureRequest
    )

Source from the content-addressed store, hash-verified

347
348 @pytest.fixture
349 def simple_module(
350 self, tmp_path: Path, request: pytest.FixtureRequest
351 ) -> Iterator[Path]:
352 name = f"mymod_{request.node.name}"
353 fn = tmp_path / f"_src/tests/{name}.py"
354 fn.parent.mkdir(parents=True)
355 fn.write_text("def foo(x): return 40 + x", encoding="utf-8")
356 module_name = module_name_from_path(fn, root=tmp_path)
357 yield fn
358 sys.modules.pop(module_name, None)
359
360 def test_importmode_importlib(
361 self,

Callers

nothing calls this directly

Calls 4

module_name_from_pathFunction · 0.90
write_textMethod · 0.80
popMethod · 0.80
mkdirMethod · 0.45

Tested by

no test coverage detected