Invoca el agente real incident_analyzer (assets del repo, LLM mock) vía TestClient y comprueba status=completed, final_output y que el decision_path recorre los seis nodos del grafo. Añade conftest con la fixture integration_client (env apuntando a agents/ y policies/ del repo, caches DI limpiadas). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
32 lines
974 B
Python
32 lines
974 B
Python
"""Fixtures compartidas para tests de integración."""
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from agentforge_core.api import deps
|
|
|
|
|
|
@pytest.fixture
|
|
def integration_client(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): # type: ignore[no-untyped-def]
|
|
"""Cliente FastAPI con env apuntando a los assets reales del repo."""
|
|
from fastapi.testclient import TestClient
|
|
|
|
from agentforge_core.main import create_app
|
|
|
|
repo_root = Path(__file__).parent.parent.parent
|
|
monkeypatch.setenv("DATA_DIR", str(tmp_path))
|
|
monkeypatch.setenv("AGENTS_DIR", str(repo_root / "agents"))
|
|
monkeypatch.setenv("POLICIES_DIR", str(repo_root / "policies"))
|
|
monkeypatch.setenv("LLM_PROVIDER", "mock")
|
|
for fn in (
|
|
deps.get_settings,
|
|
deps.get_registry,
|
|
deps.get_policy_store,
|
|
deps.get_orchestrator,
|
|
deps.get_llm_provider,
|
|
deps.get_guardrail_engine,
|
|
):
|
|
fn.cache_clear()
|
|
return TestClient(create_app())
|