fix: follow the shared lookup in the judge guard

The core extras loop reaches validated_choice through ExtraResolver.resolve now, so the guard follows that call instead of counting direct calls.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 00:12:43 +02:00
1 parent 5e84244cb9
commit e1c1fffdaf
1 file changed
+16 -1
+16 -1
View File
@@ -113,7 +113,22 @@ class ValidatedChoice(unittest.TestCase):
call for call in ast.walk(builder)
if isinstance(call, ast.Call) and getattr(call.func, "id", None) == "validated_choice"
]
self.assertGreaterEqual(len(calls), 2)
self.assertGreaterEqual(len(calls), 1)
# The core extras go through the lookup verify shares, which judges.
self.assertTrue(any(
isinstance(call, ast.Call) and getattr(call.func, "attr", None) == "resolve"
and getattr(call.func.value, "id", None) == "extra_resolver"
for call in ast.walk(builder)
))
extras = ast.parse((REPO_ROOT / "scripts" / "packextras.py").read_text(encoding="utf-8"))
resolve = next(
node for node in ast.walk(extras)
if isinstance(node, ast.FunctionDef) and node.name == "resolve"
)
self.assertTrue(any(
isinstance(call, ast.Call) and getattr(call.func, "id", None) == "validated_choice"
for call in ast.walk(resolve)
))
class ManifestsServeWhatTheCoreAccepts(unittest.TestCase):