Two stages: register as a modifier (it was never installed), test that every install() is provided

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tw9fjWwkXVabCNSQ53xaW1
This commit is contained in:
Claude
2026-10-29 11:04:16 +00:00
parent 3837d585e0
commit 373f0ea1ab
2 changed files with 26 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
"""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}"
+3
View File
@@ -52,3 +52,6 @@ def install(patcher, values, key):
size, steps = float(values.get("size", 0.7)), int(values.get("steps", 2))
patcher.add_wrapper_with_key(WrappersMP.OUTER_SAMPLE, key, make_wrapper(size, steps))
return f"first {steps} step(s) at {size:.0%} of the size"
PROVIDES = {"modifier": install}