reorg files

This commit is contained in:
2026-07-22 23:49:44 +02:00
parent 98ac4abca1
commit 0526406472
69 changed files with 760 additions and 539 deletions
+8 -7
View File
@@ -5,6 +5,8 @@ from types import SimpleNamespace
import pytest
from agentci.application.worker.errors import safe_error
from agentci.application.worker.runner import Worker
from agentci.engine.events import (
CommentLinked,
JobCompleted,
@@ -30,8 +32,7 @@ from agentci.engine.model import (
)
from agentci.engine.reducer import render_job_comment
from agentci.engine.repository import Repository
from agentci.gitea import CommentInfo
from agentci.worker import Worker, _safe_error
from agentci.integrations.gitea.models import CommentInfo
from agentci.workflows.render import JobRejected
MIGRATIONS = Path(__file__).parents[1] / "src" / "agentci" / "migrations"
@@ -408,7 +409,7 @@ async def test_execute_completes_with_workflow_comment(
async def dispatch(_job: Job, _run: object, _services: object) -> str:
return "final workflow body"
monkeypatch.setattr("agentci.worker.dispatch", dispatch)
monkeypatch.setattr("agentci.application.worker.execution.dispatch", dispatch)
execute = task()
await value._execute(execute, current)
@@ -432,7 +433,7 @@ async def test_execute_records_expected_rejection(
async def dispatch(_job: Job, _run: object, _services: object) -> str:
raise JobRejected("pull request is closed")
monkeypatch.setattr("agentci.worker.dispatch", dispatch)
monkeypatch.setattr("agentci.application.worker.execution.dispatch", dispatch)
await make_worker(tmp_path, repository)._execute(task(), current)
@@ -452,7 +453,7 @@ async def test_execute_records_failure_at_latest_persisted_stage(
repository.job = replace(repository.job, stage="cloning")
raise RuntimeError("provider\nfailed")
monkeypatch.setattr("agentci.worker.dispatch", dispatch)
monkeypatch.setattr("agentci.application.worker.execution.dispatch", dispatch)
await make_worker(tmp_path, repository)._execute(task(), current)
@@ -471,7 +472,7 @@ async def test_execute_marks_running_job_interrupted_after_restart(
async def unexpected_dispatch(_job: Job, _run: object, _services: object) -> str:
pytest.fail("running jobs must not be dispatched again")
monkeypatch.setattr("agentci.worker.dispatch", unexpected_dispatch)
monkeypatch.setattr("agentci.application.worker.execution.dispatch", unexpected_dispatch)
execute = task()
await make_worker(tmp_path, repository)._execute(execute, current)
@@ -642,7 +643,7 @@ async def test_abort_without_persisted_sessions_is_noop(tmp_path: Path) -> None:
def test_safe_error_is_single_line_and_bounded() -> None:
value = _safe_error(RuntimeError("bad\n" + "x" * 2000))
value = safe_error(RuntimeError("bad\n" + "x" * 2000))
assert "\n" not in value
assert len(value) == 1000