Skip to content

Commit 22d1367

Browse files
committed
Fix type errors and formatting in tests
- Replace untyped lambdas with properly typed async functions - Fix pyright reportUnknownLambdaType errors - Apply ruff formatting
1 parent 1bea7c0 commit 22d1367

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/server/test_streamable_http_manager.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,11 @@ async def test_idle_session_cleanup():
280280

281281
async with manager.run():
282282
# Mock the app.run to prevent it from doing anything
283-
app.run = AsyncMock(side_effect=lambda *args, **kwargs: anyio.sleep(float("inf")))
283+
284+
async def mock_infinite_sleep(*args: Any, **kwargs: Any) -> None:
285+
await anyio.sleep(float("inf"))
286+
287+
app.run = AsyncMock(side_effect=mock_infinite_sleep)
284288

285289
# Create mock transports directly to simulate sessions
286290
# We'll bypass the HTTP layer for simplicity
@@ -323,7 +327,11 @@ async def test_cleanup_only_above_threshold():
323327
)
324328

325329
async with manager.run():
326-
app.run = AsyncMock(side_effect=lambda *args, **kwargs: anyio.sleep(float("inf")))
330+
331+
async def mock_infinite_sleep(*args: Any, **kwargs: Any) -> None:
332+
await anyio.sleep(float("inf"))
333+
334+
app.run = AsyncMock(side_effect=mock_infinite_sleep)
327335

328336
# Create just one session (below threshold)
329337
transport = MagicMock(spec=StreamableHTTPServerTransport)

0 commit comments

Comments
 (0)