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

Function derive_importpath

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

Source from the content-addressed store, hash-verified

91
92
93def derive_importpath(import_path: str, raising: bool) -> Tuple[str, object]:
94 if not isinstance(import_path, str) or "." not in import_path:
95 raise TypeError(f"must be absolute import path string, not {import_path!r}")
96 module, attr = import_path.rsplit(".", 1)
97 target = resolve(module)
98 if raising:
99 annotated_getattr(target, attr, ann=module)
100 return attr, target
101
102
103class Notset:

Callers 2

setattrMethod · 0.85
delattrMethod · 0.85

Calls 2

resolveFunction · 0.85
annotated_getattrFunction · 0.85

Tested by

no test coverage detected