Skip to content

Commit 227a8f8

Browse files
committed
fix: resolve linting errors in test case
- Sort imports alphabetically (asyncio before threading) - Add proper ExceptionGroup import with fallback for older Python versions - Remove unnecessary f-string prefix - All linting checks now pass
1 parent e0331e6 commit 227a8f8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/shared/test_streamable_http.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
from collections.abc import Generator
1212
from typing import Any
1313

14+
try:
15+
from builtins import ExceptionGroup
16+
except ImportError:
17+
from exceptiongroup import ExceptionGroup
18+
1419
import anyio
1520
import httpx
1621
import pytest
@@ -1620,8 +1625,8 @@ async def html_endpoint(request: Request):
16201625
port = s.getsockname()[1]
16211626

16221627
# Use a thread instead of multiprocessing to avoid pickle issues
1623-
import threading
16241628
import asyncio
1629+
import threading
16251630

16261631
def run_server():
16271632
loop = asyncio.new_event_loop()
@@ -1662,7 +1667,7 @@ def find_mcp_error(exc_group):
16621667

16631668
mcp_error = find_mcp_error(exc_info.value)
16641669

1665-
assert mcp_error is not None, f"Expected McpError in ExceptionGroup hierarchy"
1670+
assert mcp_error is not None, "Expected McpError in ExceptionGroup hierarchy"
16661671
assert "Unexpected content type" in str(mcp_error)
16671672
assert "text/html" in str(mcp_error)
16681673

0 commit comments

Comments
 (0)