"""Every public bundle must be free of oracle material; every oracle must exist with the required files.""" import os, glob, json, sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "src")) from pgar.isolation import FORBIDDEN_NAME_FRAGMENTS REPO = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) def test_bundles_clean_and_oracles_present(): for b in sorted(glob.glob(os.path.join(REPO, "tasks", "public_bundles", "*"))): tid = os.path.basename(b) for root, _, fs in os.walk(b): for f in fs: assert not any(x.lower() in f.lower() for x in FORBIDDEN_NAME_FRAGMENTS), (tid, f) if f.endswith((".md", ".json", ".csv", ".txt")): txt = open(os.path.join(root, f), errors="replace").read().lower() assert "wp29-oracles" not in txt and "reference value" not in txt, (tid, f) od = os.path.expanduser(f"~/wp29-oracles/{tid}") assert os.path.isfile(os.path.join(od, "oracle.json")) and os.path.isfile(os.path.join(od, "evaluate.py")), tid assert os.path.isfile(os.path.join(b, "bundle.json")) and os.path.isfile(os.path.join(b, "gate_spec.json")) and os.path.isfile(os.path.join(b, "TASK.md"))