The core now keeps only the shared bridge contract (semif_agent/bridges/base.py) and the discovery registry (semif_agent/bridges/registry.py); a pack ships its own bridge under bridge/<name>.py and the registry imports it by convention from the pack's declared `bridges`. The bridge's hermetic test moves here too and runs via the agent repo's tests/test_packs.py (or standalone with conftest.py).
18 lines
679 B
Python
18 lines
679 B
Python
"""Make the agent checkout importable when running this pack's tests standalone.
|
|
|
|
A pack's bridge test imports `semif_agent` (the shared bridge contract and the
|
|
discovery registry). The pack lives inside an agent checkout at `packs/<name>/`,
|
|
so this adds the checkout root to `sys.path` — running the tests through the
|
|
agent repo (`pytest tests/test_packs.py`) already provides it, but
|
|
`cd packs/<name> && pytest` needs this.
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
for _parent in Path(__file__).resolve().parents:
|
|
if (_parent / "semif_agent" / "__init__.py").is_file():
|
|
if str(_parent) not in sys.path:
|
|
sys.path.insert(0, str(_parent))
|
|
break
|