Skip to content

Commit 90ad48a

Browse files
Add missing type annotations to test functions
Restore type annotations on test function parameters in test_streamable_http.py that were accidentally removed during the function renaming from streamablehttp_client to streamable_http_client. Added type annotations to: - Fixture parameters: basic_server, basic_server_url, json_response_server, json_server_url, event_server, monkeypatch - Test function parameters: initialized_client_session This fixes all 61 pyright errors and ensures type safety matches the main branch standards.
1 parent cc137e2 commit 90ad48a

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tests/shared/test_streamable_http.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ async def initialized_client_session(basic_server: None, basic_server_url: str):
844844

845845

846846
@pytest.mark.anyio
847-
async def test_streamable_http_client_basic_connection(basic_server, basic_server_url):
847+
async def test_streamable_http_client_basic_connection(basic_server: None, basic_server_url: str):
848848
"""Test basic client connection with initialization."""
849849
async with streamable_http_client(f"{basic_server_url}/mcp") as (
850850
read_stream,
@@ -862,7 +862,7 @@ async def test_streamable_http_client_basic_connection(basic_server, basic_serve
862862

863863

864864
@pytest.mark.anyio
865-
async def test_streamable_http_client_resource_read(initialized_client_session):
865+
async def test_streamable_http_client_resource_read(initialized_client_session: ClientSession):
866866
"""Test client resource read functionality."""
867867
response = await initialized_client_session.read_resource(uri=AnyUrl("foobar://test-resource"))
868868
assert len(response.contents) == 1
@@ -872,7 +872,7 @@ async def test_streamable_http_client_resource_read(initialized_client_session):
872872

873873

874874
@pytest.mark.anyio
875-
async def test_streamable_http_client_tool_invocation(initialized_client_session):
875+
async def test_streamable_http_client_tool_invocation(initialized_client_session: ClientSession):
876876
"""Test client tool invocation."""
877877
# First list tools
878878
tools = await initialized_client_session.list_tools()
@@ -887,7 +887,7 @@ async def test_streamable_http_client_tool_invocation(initialized_client_session
887887

888888

889889
@pytest.mark.anyio
890-
async def test_streamable_http_client_error_handling(initialized_client_session):
890+
async def test_streamable_http_client_error_handling(initialized_client_session: ClientSession):
891891
"""Test error handling in client."""
892892
with pytest.raises(McpError) as exc_info:
893893
await initialized_client_session.read_resource(uri=AnyUrl("unknown://test-error"))
@@ -896,7 +896,7 @@ async def test_streamable_http_client_error_handling(initialized_client_session)
896896

897897

898898
@pytest.mark.anyio
899-
async def test_streamable_http_client_session_persistence(basic_server, basic_server_url):
899+
async def test_streamable_http_client_session_persistence(basic_server: None, basic_server_url: str):
900900
"""Test that session ID persists across requests."""
901901
async with streamable_http_client(f"{basic_server_url}/mcp") as (
902902
read_stream,
@@ -924,7 +924,7 @@ async def test_streamable_http_client_session_persistence(basic_server, basic_se
924924

925925

926926
@pytest.mark.anyio
927-
async def test_streamable_http_client_json_response(json_response_server, json_server_url):
927+
async def test_streamable_http_client_json_response(json_response_server: None, json_server_url: str):
928928
"""Test client with JSON response mode."""
929929
async with streamable_http_client(f"{json_server_url}/mcp") as (
930930
read_stream,
@@ -952,7 +952,7 @@ async def test_streamable_http_client_json_response(json_response_server, json_s
952952

953953

954954
@pytest.mark.anyio
955-
async def test_streamable_http_client_get_stream(basic_server, basic_server_url):
955+
async def test_streamable_http_client_get_stream(basic_server: None, basic_server_url: str):
956956
"""Test GET stream functionality for server-initiated messages."""
957957
import mcp.types as types
958958
from mcp.shared.session import RequestResponder
@@ -993,7 +993,7 @@ async def message_handler(
993993

994994

995995
@pytest.mark.anyio
996-
async def test_streamable_http_client_session_termination(basic_server, basic_server_url):
996+
async def test_streamable_http_client_session_termination(basic_server: None, basic_server_url: str):
997997
"""Test client session termination functionality."""
998998

999999
captured_session_id = None
@@ -1035,7 +1035,9 @@ async def test_streamable_http_client_session_termination(basic_server, basic_se
10351035

10361036

10371037
@pytest.mark.anyio
1038-
async def test_streamable_http_client_session_termination_204(basic_server, basic_server_url, monkeypatch):
1038+
async def test_streamable_http_client_session_termination_204(
1039+
basic_server: None, basic_server_url: str, monkeypatch: pytest.MonkeyPatch
1040+
):
10391041
"""Test client session termination functionality with a 204 response.
10401042
10411043
This test patches the httpx client to return a 204 response for DELETEs.
@@ -1100,7 +1102,7 @@ async def mock_delete(self: httpx.AsyncClient, *args: Any, **kwargs: Any) -> htt
11001102

11011103

11021104
@pytest.mark.anyio
1103-
async def test_streamable_http_client_resumption(event_server):
1105+
async def test_streamable_http_client_resumption(event_server: tuple[SimpleEventStore, str]):
11041106
"""Test client session resumption using sync primitives for reliable coordination."""
11051107
_, server_url = event_server
11061108

0 commit comments

Comments
 (0)