Files
BAT/tests/conftest.py
b.peck ecb10b9b7b Phase 1 data layer: calc/fmt/alarms + 31 CPython tests + live gateway P1 smoke
pytest 31/31. In-gateway end-to-end: 559 activations correlated (uuid mode), 3 chatterers,
34 fleeting, 1 flood, health F(22) on the deliberately-bad sim plant. Gate G1 green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 13:08:02 -05:00

22 lines
805 B
Python

"""Register PrimeControls.{calc,fmt} from the Ignition project's code.py files so
pytest imports them exactly as the gateway does (single source of truth)."""
import importlib.util
import os
import sys
import types
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SP = os.path.join(ROOT, "ignition", "gateway", "projects", "PrimeBAT",
"ignition", "script-python", "PrimeControls")
pkg = types.ModuleType("PrimeControls")
pkg.__path__ = [SP]
sys.modules["PrimeControls"] = pkg
for mod in ("calc", "fmt"):
spec = importlib.util.spec_from_file_location(
"PrimeControls." + mod, os.path.join(SP, mod, "code.py"))
m = importlib.util.module_from_spec(spec)
sys.modules["PrimeControls." + mod] = m
spec.loader.exec_module(m)
setattr(pkg, mod, m)