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

Function derive_importpath

src/_pytest/monkeypatch.py:103–110  ·  view source on GitHub ↗
(import_path: str, raising: bool)

Source from the content-addressed store, hash-verified

101
102
103def derive_importpath(import_path: str, raising: bool) -> tuple[str, object]:
104 if not isinstance(import_path, str) or "." not in import_path:
105 raise TypeError(f"must be absolute import path string, not {import_path!r}")
106 module, attr = import_path.rsplit(".", 1)
107 target = resolve(module)
108 if raising:
109 annotated_getattr(target, attr, ann=module)
110 return attr, target
111
112
113@final

Callers 2

setattrMethod · 0.85
delattrMethod · 0.85

Calls 2

resolveFunction · 0.85
annotated_getattrFunction · 0.85

Tested by

no test coverage detected