Skip to content

Commit 6dd83fd

Browse files
CI: fix conftest src import (sys.path) + run via python -m pytest
Bare `pytest` (as CI invoked it) doesn't add the repo root to sys.path, so conftest's `from src.governance import ...` failed with ModuleNotFoundError at collection. Make conftest add the repo root itself and run CI via `python -m pytest`.
1 parent d2857d3 commit 6dd83fd

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ jobs:
2424
python -m pip install --upgrade pip
2525
pip install -r requirements.txt
2626
- name: Run tests
27-
run: pytest tests/ -q
27+
run: python -m pytest tests/ -q
2828
# Postgres integration tests skip automatically unless AGENTBRIDGE_TEST_PG is set.

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66
how the existing self-contained tests run.
77
"""
88

9+
import os
10+
import sys
11+
912
import pytest
1013

14+
# Make `src` importable however pytest is invoked — bare `pytest` (as CI runs it) does not put
15+
# the repo root on sys.path the way `python -m pytest` does.
16+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
17+
1118
from src.governance import (
1219
make_store,
1320
AgentIdentity,

0 commit comments

Comments
 (0)