|
| None | __init__ (self, Sequence[Path] roots) |
| str | identify (self, Path path) |
| bool | inside_workspace (self, Path path) |
| str|None | hash_of (self, Path path) |
| tuple[str, tuple[Path,...]] | resolve (self, str dotted) |
| tuple[str, tuple[Path,...]] | resolve_relative (self, Path origin, int level, str module, Sequence[str] names) |
| tuple[tuple[Path,...], tuple[str,...], bool] | imports_of (self, Path path) |
| tuple[tuple[Path,...], tuple[str,...]]|None | closure (self, Path path) |
Resolve dotted module names to workspace files, by path.
The resolution is deliberately FILESYSTEM-first over the declared
workspace roots and only then ``importlib``: in a worktree the
editable install can point at another checkout (the F17 shadow
class), and a key built from another checkout's bytes would be a
silent wrong answer. ``importlib`` is consulted for the top-level
name alone, which is what tells stdlib and site-packages apart
from a module that simply does not exist.
No module is ever IMPORTED here: importing a test's dependencies
at collection time would run their side effects.
Definition at line 383 of file cache.py.
| tuple[tuple[Path, ...], tuple[str, ...]] | None oct.testing.cache._ModuleIndex.closure |
( |
| self, |
|
|
Path | path ) |
Everything reachable from *path*'s imports.
Returns
-------
tuple | None
``(files, absent)``: the workspace files whose bytes join
the key, and the top-level names that resolved NOWHERE and
whose absence joins it instead. The file itself is not in
*files* - it is hashed separately as the key's first input.
``None`` means a first-party input could not be resolved or
read, which fails the whole key closed.
Definition at line 670 of file cache.py.
| tuple[str, tuple[Path, ...]] oct.testing.cache._ModuleIndex.resolve |
( |
| self, |
|
|
str | dotted ) |
Resolve *dotted* to the source files importing it executes.
Returns
-------
tuple
``(kind, files)`` where *kind* is one of
:data:`KIND_WORKSPACE`, :data:`KIND_EXTERNAL` or
:data:`KIND_MISSING`. A workspace package contributes every
``__init__.py`` on the way down, because importing the leaf
executes all of them.
Definition at line 502 of file cache.py.