31 lines
937 B
Python
31 lines
937 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from agent_gitea.config import AppConfig
|
|
from agent_gitea.db import Database
|
|
|
|
|
|
def make_config(tmp_path: Path, **overrides: object) -> AppConfig:
|
|
data = {
|
|
"gitea": {"base_url": "https://gitea.test", "token_env": "GITEA_TOKEN"},
|
|
"database_path": tmp_path / "state.sqlite3",
|
|
"scheduler": {"interval_seconds": 1, "concurrency": 1, "lease_seconds": 60},
|
|
"workspace": {"root": tmp_path / "workspaces", "cleanup_on_success": False},
|
|
"agents": {
|
|
"implementer": {"command": ["implementer", "{prompt_path}"]},
|
|
"reviewer": {"command": ["reviewer", "{prompt_path}"]},
|
|
},
|
|
}
|
|
data.update(overrides)
|
|
return AppConfig.model_validate(data)
|
|
|
|
|
|
@pytest.fixture
|
|
def db(tmp_path: Path) -> Database:
|
|
database = Database(tmp_path / "state.sqlite3")
|
|
database.migrate()
|
|
return database
|