fix: Use contextlib.suppress instead of try-except-pass (SIM105)
- Replace try-except-pass with contextlib.suppress in test_async_operations.py - Replace try-except-pass with contextlib.suppress in test_fixtures.py - Fixes ruff SIM105 linting errors
This commit is contained in:
parent
5b40df724e
commit
4fe92a2b5b
2 changed files with 5 additions and 8 deletions
|
|
@ -5,6 +5,7 @@ Tests concurrent operations, queue management, and async patterns.
|
|||
"""
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import json
|
||||
import time
|
||||
|
||||
|
|
@ -246,7 +247,7 @@ class TestAsyncErrorHandling:
|
|||
# Create a very large episode that might timeout
|
||||
large_content = 'x' * 1000000 # 1MB of data
|
||||
|
||||
try:
|
||||
with contextlib.suppress(asyncio.TimeoutError):
|
||||
await asyncio.wait_for(
|
||||
session.call_tool(
|
||||
'add_memory',
|
||||
|
|
@ -258,11 +259,8 @@ class TestAsyncErrorHandling:
|
|||
'group_id': group_id,
|
||||
},
|
||||
),
|
||||
timeout=2.0, # Short timeout
|
||||
timeout=2.0, # Short timeout - expected to timeout
|
||||
)
|
||||
except asyncio.TimeoutError:
|
||||
# Expected timeout
|
||||
pass
|
||||
|
||||
# Verify server is still responsive after timeout
|
||||
status_result = await session.call_tool('get_status', {})
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Shared test fixtures and utilities for Graphiti MCP integration tests.
|
|||
"""
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
import random
|
||||
|
|
@ -203,10 +204,8 @@ async def graphiti_test_client(
|
|||
yield session, test_group_id
|
||||
finally:
|
||||
# Cleanup: Clear test data
|
||||
try:
|
||||
with contextlib.suppress(Exception):
|
||||
await session.call_tool('clear_graph', {'group_id': test_group_id})
|
||||
except Exception:
|
||||
pass # Ignore cleanup errors
|
||||
|
||||
await session.close()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue