Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw9fjWwkXVabCNSQ53xaW1
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
"""A module with an `install(patcher, values, key)` that never lists it in PROVIDES is never installed (the
|
|
Load Modifiers node only calls what is provided), and its own tests still pass because they call it directly."""
|
|
|
|
import importlib
|
|
import pkgutil
|
|
|
|
import modules
|
|
|
|
|
|
def test_every_modifier_install_is_provided():
|
|
missing = []
|
|
for info in pkgutil.walk_packages(modules.__path__, "modules."):
|
|
if not info.ispkg or info.name.rsplit(".", 1)[-1] in ("tests", "_core"):
|
|
continue
|
|
try:
|
|
mod = importlib.import_module(info.name)
|
|
except Exception: # noqa: BLE001 -- a missing dependency is not this test's business
|
|
continue
|
|
fn = getattr(mod, "install", None)
|
|
if fn is not None and getattr(mod, "__file__", "").endswith("__init__.py") and hasattr(mod, "ID"):
|
|
if getattr(mod, "PROVIDES", {}).get("modifier") is not fn:
|
|
missing.append(info.name)
|
|
assert not missing, f"install() not provided as a modifier: {missing}"
|