fix(ci): resolve test collection and async failures

- Add conftest.py to inject lib/ onto sys.path, fixing
  ModuleNotFoundError on identity test collection
- Add pytest-asyncio to CI install step and pyproject.toml
  test extras; set asyncio_mode=auto to resolve 31 async
  test failures flagged in session tech debt backlog
- All 35 tests now pass; 8 skipped (live API, expected)

Ref: Session Snapshot 2026-04-13 — "Pytest validation incomplete"
This commit is contained in:
nathan 2026-04-13 13:22:00 -04:00
parent 25d8af869f
commit cc00efc4c1
4 changed files with 21 additions and 1 deletions

View File

@ -37,7 +37,7 @@ jobs:
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -e . pip install -e .
pip install pytest pytest-cov black ruff pip install pytest pytest-cov pytest-asyncio black ruff
- name: Lint with ruff - name: Lint with ruff
working-directory: nexus-mcp working-directory: nexus-mcp

9
nexus-mcp/conftest.py Normal file
View File

@ -0,0 +1,9 @@
"""
Root conftest.py adds lib/ to sys.path so legacy identity tests can import
adapters directly (e.g. `from ad_adapter import ...`) without package prefix.
"""
import sys
from pathlib import Path
# Allow bare imports like `from ad_adapter import ...` used by identity_tests/
sys.path.insert(0, str(Path(__file__).parent / "lib"))

View File

@ -26,8 +26,18 @@ dependencies = [
[project.scripts] [project.scripts]
nexus-mcp = "main:main" nexus-mcp = "main:main"
[project.optional-dependencies]
test = [
"pytest>=8.0.0",
"pytest-cov>=5.0.0",
"pytest-asyncio>=0.24.0",
]
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
where = ["src"] where = ["src"]
[tool.setuptools.package-dir] [tool.setuptools.package-dir]
"" = "src" "" = "src"
[tool.pytest.ini_options]
asyncio_mode = "auto"

View File

@ -9,6 +9,7 @@ src/nexus_mcp.egg-info/top_level.txt
src/shards/__init__.py src/shards/__init__.py
src/shards/assets.py src/shards/assets.py
src/shards/audit.py src/shards/audit.py
src/shards/audit_minimal.py
src/shards/identity.py src/shards/identity.py
src/shards/itsm.py src/shards/itsm.py
src/shards/logistics.py src/shards/logistics.py