Document task DB access and unify background task DB handling

This commit is contained in:
2026-04-17 17:18:49 +02:00
parent 16687b0520
commit 5e5d7c34b2
12 changed files with 139 additions and 90 deletions

View File

@@ -34,6 +34,7 @@ def _make_app(flush_count: int = 0) -> MagicMock:
app.state.db.close = AsyncMock()
app.state.scheduler = MagicMock()
app.state.settings = MagicMock(database_path="/tmp/fake.db")
app.state.runtime_settings = None
return app
@@ -51,7 +52,7 @@ class TestRunFlush:
app = _make_app()
with patch(
"app.tasks.geo_cache_flush.open_db",
"app.tasks.db.open_db",
new_callable=AsyncMock,
return_value=app.state.db,
), patch(
@@ -69,7 +70,7 @@ class TestRunFlush:
app = _make_app()
with patch(
"app.tasks.geo_cache_flush.open_db",
"app.tasks.db.open_db",
new_callable=AsyncMock,
return_value=app.state.db,
), patch(
@@ -89,7 +90,7 @@ class TestRunFlush:
app = _make_app()
with patch(
"app.tasks.geo_cache_flush.open_db",
"app.tasks.db.open_db",
new_callable=AsyncMock,
return_value=app.state.db,
), patch(