test: update test fixtures to use @with_session decorator

- Replace manual session management in test fixtures with @with_session decorator
- Simplify async test fixtures by removing explicit session handling
- Update dependencies in pyproject.toml and uv.lock
This commit is contained in:
2025-09-23 12:09:26 -06:00
parent 8ad1270229
commit 27b3b9cdee
14 changed files with 1776 additions and 1837 deletions

View File

@@ -134,7 +134,7 @@ async def test_ics_fetch_service_extract_room_events():
@pytest.mark.asyncio
async def test_ics_sync_service_sync_room_calendar(session):
async def test_ics_sync_service_sync_room_calendar(db_db_session):
# Create room
room = await rooms_controller.add(
session,
@@ -151,7 +151,7 @@ async def test_ics_sync_service_sync_room_calendar(session):
ics_url="https://calendar.example.com/test.ics",
ics_enabled=True,
)
await session.flush()
await db_session.flush()
# Mock ICS content
cal = Calendar()
@@ -172,7 +172,7 @@ async def test_ics_sync_service_sync_room_calendar(session):
@asynccontextmanager
async def mock_session_context():
yield session
yield db_session
class MockSessionMaker:
def __call__(self):
@@ -280,7 +280,7 @@ async def test_ics_sync_service_skip_disabled():
@pytest.mark.asyncio
async def test_ics_sync_service_error_handling(session):
async def test_ics_sync_service_error_handling(db_db_session):
# Create room
room = await rooms_controller.add(
session,
@@ -297,13 +297,13 @@ async def test_ics_sync_service_error_handling(session):
ics_url="https://calendar.example.com/error.ics",
ics_enabled=True,
)
await session.flush()
await db_session.flush()
from contextlib import asynccontextmanager
@asynccontextmanager
async def mock_session_context():
yield session
yield db_session
class MockSessionMaker:
def __call__(self):