-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
30 lines (23 loc) · 1015 Bytes
/
conftest.py
File metadata and controls
30 lines (23 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from __future__ import annotations
from pathlib import Path
import pytest
from fastapi.testclient import TestClient
from app.core.jobs import AsyncJobManager
from app.core.tracing import TraceRecorder
from app.core.schema import StrategyConfig
from app.engine.generation import MockGenerationEngine
from app.engine.orchestrator import Orchestrator
from app.main import app
from app.storage.repository import JsonRepository
@pytest.fixture()
def client(tmp_path: Path) -> TestClient:
repository = JsonRepository(tmp_path / "data")
generator = MockGenerationEngine((tmp_path / "data" / "artifacts"))
trace_recorder = TraceRecorder(tmp_path / "data" / "traces")
app.state.job_manager = AsyncJobManager()
app.state.trace_recorder = trace_recorder
app.state.orchestrator = Orchestrator(repository=repository, generator=generator, trace_recorder=trace_recorder)
return TestClient(app)
@pytest.fixture()
def strategy_config() -> dict:
return StrategyConfig().model_dump(mode="json")