dodil/erp-brick-product

tests/contract_checks.py

"""Every call this brick makes to a neighbour is checked against the CALLEE's signed spec (erp-method). A missing checkout is an
error, never a skip. product's one outbound call is business-partner's GET /partners/{bp_id}; that spec lists no seams at all, so
there is nothing to check it against (a spec gap, reported)."""
import os
import pathlib

HERE = pathlib.Path(__file__).resolve().parent
METHOD_DIR = os.environ.get("ERP_METHOD_DIR") or str(HERE.parents[1] / "erp-method")
if not (pathlib.Path(METHOD_DIR) / "modules" / "shared.yaml").exists():
    raise RuntimeError(f"seam contract checks need an erp-method checkout: set ERP_METHOD_DIR (tried {METHOD_DIR})")