reorg files
This commit is contained in:
+8
-7
@@ -4,7 +4,8 @@ from types import SimpleNamespace
|
||||
import pytest
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
import agentci.app as app_module
|
||||
import agentci.api.app as app_module
|
||||
import agentci.api.lifespan as lifespan_module
|
||||
|
||||
|
||||
class BlockingWorker:
|
||||
@@ -56,8 +57,8 @@ async def test_lifespan_starts_worker_cancels_it_and_closes_runtime(
|
||||
built_with.append(settings)
|
||||
return runtime
|
||||
|
||||
monkeypatch.setattr(app_module, "build_runtime", build)
|
||||
monkeypatch.setattr(app_module, "configure_logging", lambda: configured.append(True))
|
||||
monkeypatch.setattr(lifespan_module, "build_runtime", build)
|
||||
monkeypatch.setattr(lifespan_module, "configure_logging", lambda: configured.append(True))
|
||||
application = app_module.create_app(selected_settings) # type: ignore[arg-type]
|
||||
|
||||
async with application.router.lifespan_context(application):
|
||||
@@ -80,8 +81,8 @@ async def test_lifespan_closes_runtime_when_worker_task_fails(
|
||||
async def build(_settings: object) -> FakeRuntime:
|
||||
return runtime
|
||||
|
||||
monkeypatch.setattr(app_module, "build_runtime", build)
|
||||
monkeypatch.setattr(app_module, "configure_logging", lambda: None)
|
||||
monkeypatch.setattr(lifespan_module, "build_runtime", build)
|
||||
monkeypatch.setattr(lifespan_module, "configure_logging", lambda: None)
|
||||
application = app_module.create_app(SimpleNamespace()) # type: ignore[arg-type]
|
||||
|
||||
with pytest.raises(RuntimeError, match="worker failed"):
|
||||
@@ -100,8 +101,8 @@ async def test_lifespan_propagates_runtime_startup_failure_without_starting_work
|
||||
async def fail_build(_settings: object) -> None:
|
||||
raise RuntimeError("database unavailable")
|
||||
|
||||
monkeypatch.setattr(app_module, "build_runtime", fail_build)
|
||||
monkeypatch.setattr(app_module, "configure_logging", lambda: configured.append(True))
|
||||
monkeypatch.setattr(lifespan_module, "build_runtime", fail_build)
|
||||
monkeypatch.setattr(lifespan_module, "configure_logging", lambda: configured.append(True))
|
||||
application = app_module.create_app(SimpleNamespace()) # type: ignore[arg-type]
|
||||
|
||||
with pytest.raises(RuntimeError, match="database unavailable"):
|
||||
|
||||
Reference in New Issue
Block a user