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

Method test_importmode_importlib

testing/test_pathlib.py:279–287  ·  view source on GitHub ↗

`importlib` mode does not change sys.path.

(self, simple_module: Path, tmp_path: Path)

Source from the content-addressed store, hash-verified

277 return fn
278
279 def test_importmode_importlib(self, simple_module: Path, tmp_path: Path) -> None:
280 """`importlib` mode does not change sys.path."""
281 module = import_path(simple_module, mode="importlib", root=tmp_path)
282 assert module.foo(2) == 42 # type: ignore[attr-defined]
283 assert str(simple_module.parent) not in sys.path
284 assert module.__name__ in sys.modules
285 assert module.__name__ == "_src.tests.mymod"
286 assert "_src" in sys.modules
287 assert "_src.tests" in sys.modules
288
289 def test_importmode_twice_is_different_module(
290 self, simple_module: Path, tmp_path: Path

Callers

nothing calls this directly

Calls 2

import_pathFunction · 0.90
fooMethod · 0.45

Tested by

no test coverage detected