forked from b.peck/BAT
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>
This commit is contained in:
21
tests/conftest.py
Normal file
21
tests/conftest.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""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)
|
||||
Reference in New Issue
Block a user