Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/tests/backend/common/database/test_database_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,15 @@ async def get_team_agent(self, team_id, agent_name): return None

database = MockDatabase()

with pytest.raises(ValueError):
async with database:
async def run_database_context():
async with database as db:
assert database.initialized is True
# Raise an exception to test cleanup
raise ValueError("Test exception")

with pytest.raises(ValueError):
await run_database_context()
Comment thread
Rafi-Mohammad-69 marked this conversation as resolved.
Comment thread
Rafi-Mohammad-69 marked this conversation as resolved.

# Even with exception, close should have been called
assert database.closed is True

Expand Down
4 changes: 2 additions & 2 deletions src/tests/backend/v4/config/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ async def cancel_task():
cancel_task_handle = asyncio.create_task(cancel_task())

with self.assertRaises(asyncio.CancelledError):
await task
_ = await task
Comment thread
Rafi-Mohammad-69 marked this conversation as resolved.
Comment thread
Rafi-Mohammad-69 marked this conversation as resolved.

await cancel_task_handle

Expand All @@ -367,7 +367,7 @@ async def cancel_task():
cancel_task_handle = asyncio.create_task(cancel_task())

with self.assertRaises(asyncio.CancelledError):
await task
_ = await task
Comment thread
Rafi-Mohammad-69 marked this conversation as resolved.
Comment thread
Rafi-Mohammad-69 marked this conversation as resolved.

await cancel_task_handle

Expand Down