Skip to content

Commit 6b26179

Browse files
committed
further fixes
1 parent 6280365 commit 6b26179

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

backend/app/services/user_settings_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,13 @@ def parse_value(val: object) -> object:
393393
if "notifications" in upd:
394394
n = parse_value(upd["notifications"])
395395
if isinstance(n, dict):
396-
channels: list[NotificationChannel] = [NotificationChannel(c) for c in n.get("channels", [])]
396+
notif_channels: list[NotificationChannel] = [NotificationChannel(c) for c in n.get("channels", [])]
397397
settings.notifications = DomainNotificationSettings(
398398
execution_completed=n.get("execution_completed", settings.notifications.execution_completed),
399399
execution_failed=n.get("execution_failed", settings.notifications.execution_failed),
400400
system_updates=n.get("system_updates", settings.notifications.system_updates),
401401
security_alerts=n.get("security_alerts", settings.notifications.security_alerts),
402-
channels=channels or settings.notifications.channels,
402+
channels=notif_channels or settings.notifications.channels,
403403
)
404404
if "editor" in upd:
405405
e = parse_value(upd["editor"])

backend/tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,16 @@ def create_test_app():
127127

128128
# ===== App without lifespan for tests =====
129129
@pytest_asyncio.fixture(scope="session")
130-
async def app():
130+
async def app(_test_env): # type: ignore[valid-type]
131131
"""Create FastAPI app once per session/worker.
132132
133133
Session-scoped to avoid Pydantic schema validator memory issues when
134134
FastAPI recreates OpenAPI schemas hundreds of times with pytest-xdist.
135135
See: https://github.com/pydantic/pydantic/issues/1864
136136
137+
Depends on _test_env to ensure env vars (REDIS_DB, DATABASE_NAME, etc.)
138+
are set before the app/Settings are created.
139+
137140
Note: Tests must not modify app.state or registered routes.
138141
Use function-scoped `client` fixture for test isolation.
139142
"""

backend/tests/integration/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ async def _cleanup(db: Database, redis_client: redis.Redis):
1111
1212
Only pre-test cleanup - post-test cleanup causes event loop issues
1313
when SSE/streaming tests hold connections across loop boundaries.
14+
15+
NOTE: With pytest-xdist, each worker uses a separate Redis database
16+
(gw0→db0, gw1→db1, etc.), so flushdb() is safe and only affects
17+
that worker's database. See tests/conftest.py for REDIS_DB setup.
1418
"""
1519
collections = await db.list_collection_names()
1620
for name in collections:
1721
if not name.startswith("system."):
1822
await db.drop_collection(name)
23+
1924
await redis_client.flushdb()
2025

2126
yield

0 commit comments

Comments
 (0)