88a1dab810
---ci--- phase: 7 milestone: v0.2 status: complete requirements: covered: [REQ-2-001, REQ-2-002, REQ-2-003, REQ-2-004, REQ-2-005, REQ-2-006, REQ-2-007, REQ-2-008, REQ-2-009, REQ-2-010, REQ-2-011, REQ-2-012] partial: [] ---/ci--- Milestone v0.2 (ai-tutor-architecture) merged to main. Escalation record (audit remediation, durable): P1 executor delegation failed twice (empty subagent results, zero files created); auto-resolved at full autonomy to inline execution with identical plan fidelity (commit 3271373, reflog-only after phase branch squash-delete).
33 lines
890 B
Python
33 lines
890 B
Python
"""Test suite — conftest: mock provider only, zero network (enforced)."""
|
|
|
|
import os
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from ai_service.config import Settings
|
|
from ai_service.llm.mock import MockProvider
|
|
from ai_service.main import create_app
|
|
|
|
|
|
@pytest.fixture()
|
|
def settings() -> Settings:
|
|
os.environ["AI_PROVIDER"] = "mock"
|
|
return Settings(provider="mock", model="gemma4:31b", port=8421)
|
|
|
|
|
|
@pytest.fixture()
|
|
def app(settings: Settings):
|
|
return create_app(settings)
|
|
|
|
|
|
@pytest.fixture()
|
|
def client(app):
|
|
with TestClient(app) as c:
|
|
# Mechanical cloud-free guard (GRILL advisory a): the app under test
|
|
# MUST be wired to the deterministic mock provider.
|
|
assert isinstance(app.state.provider, MockProvider), (
|
|
f"tests must run against MockProvider, got {type(app.state.provider).__name__}"
|
|
)
|
|
yield c
|