Skip to content

Commit 6f59ce2

Browse files
felixweinbergermaxisbey
authored andcommitted
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 726d051 commit 6f59ce2

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
@@ -848,7 +848,7 @@ async def initialized_client_session(basic_server: None, basic_server_url: str):
848848

849849

850850
@pytest.mark.anyio
851-
async def test_streamable_http_client_basic_connection(basic_server, basic_server_url):
851+
async def test_streamable_http_client_basic_connection(basic_server: None, basic_server_url: str):
852852
"""Test basic client connection with initialization."""
853853
async with streamable_http_client(f"{basic_server_url}/mcp") as (
854854
read_stream,
@@ -866,7 +866,7 @@ async def test_streamable_http_client_basic_connection(basic_server, basic_serve
866866

867867

868868
@pytest.mark.anyio
869-
async def test_streamable_http_client_resource_read(initialized_client_session):
869+
async def test_streamable_http_client_resource_read(initialized_client_session: ClientSession):
870870
"""Test client resource read functionality."""
871871
response = await initialized_client_session.read_resource(uri=AnyUrl("foobar://test-resource"))
872872
assert len(response.contents) == 1
@@ -876,7 +876,7 @@ async def test_streamable_http_client_resource_read(initialized_client_session):
876876

877877

878878
@pytest.mark.anyio
879-
async def test_streamable_http_client_tool_invocation(initialized_client_session):
879+
async def test_streamable_http_client_tool_invocation(initialized_client_session: ClientSession):
880880
"""Test client tool invocation."""
881881
# First list tools
882882
tools = await initialized_client_session.list_tools()
@@ -891,7 +891,7 @@ async def test_streamable_http_client_tool_invocation(initialized_client_session
891891

892892

893893
@pytest.mark.anyio
894-
async def test_streamable_http_client_error_handling(initialized_client_session):
894+
async def test_streamable_http_client_error_handling(initialized_client_session: ClientSession):
895895
"""Test error handling in client."""
896896
with pytest.raises(McpError) as exc_info:
897897
await initialized_client_session.read_resource(uri=AnyUrl("unknown://test-error"))
@@ -900,7 +900,7 @@ async def test_streamable_http_client_error_handling(initialized_client_session)
900900

901901

902902
@pytest.mark.anyio
903-
async def test_streamable_http_client_session_persistence(basic_server, basic_server_url):
903+
async def test_streamable_http_client_session_persistence(basic_server: None, basic_server_url: str):
904904
"""Test that session ID persists across requests."""
905905
async with streamable_http_client(f"{basic_server_url}/mcp") as (
906906
read_stream,
@@ -928,7 +928,7 @@ async def test_streamable_http_client_session_persistence(basic_server, basic_se
928928

929929

930930
@pytest.mark.anyio
931-
async def test_streamable_http_client_json_response(json_response_server, json_server_url):
931+
async def test_streamable_http_client_json_response(json_response_server: None, json_server_url: str):
932932
"""Test client with JSON response mode."""
933933
async with streamable_http_client(f"{json_server_url}/mcp") as (
934934
read_stream,
@@ -956,7 +956,7 @@ async def test_streamable_http_client_json_response(json_response_server, json_s
956956

957957

958958
@pytest.mark.anyio
959-
async def test_streamable_http_client_get_stream(basic_server, basic_server_url):
959+
async def test_streamable_http_client_get_stream(basic_server: None, basic_server_url: str):
960960
"""Test GET stream functionality for server-initiated messages."""
961961
import mcp.types as types
962962
from mcp.shared.session import RequestResponder
@@ -997,7 +997,7 @@ async def message_handler( # pragma: no branch
997997

998998

999999
@pytest.mark.anyio
1000-
async def test_streamable_http_client_session_termination(basic_server, basic_server_url):
1000+
async def test_streamable_http_client_session_termination(basic_server: None, basic_server_url: str):
10011001
"""Test client session termination functionality."""
10021002

10031003
captured_session_id = None
@@ -1039,7 +1039,9 @@ async def test_streamable_http_client_session_termination(basic_server, basic_se
10391039

10401040

10411041
@pytest.mark.anyio
1042-
async def test_streamable_http_client_session_termination_204(basic_server, basic_server_url, monkeypatch):
1042+
async def test_streamable_http_client_session_termination_204(
1043+
basic_server: None, basic_server_url: str, monkeypatch: pytest.MonkeyPatch
1044+
):
10431045
"""Test client session termination functionality with a 204 response.
10441046
10451047
This test patches the httpx client to return a 204 response for DELETEs.
@@ -1104,7 +1106,7 @@ async def mock_delete(self: httpx.AsyncClient, *args: Any, **kwargs: Any) -> htt
11041106

11051107

11061108
@pytest.mark.anyio
1107-
async def test_streamable_http_client_resumption(event_server):
1109+
async def test_streamable_http_client_resumption(event_server: tuple[SimpleEventStore, str]):
11081110
"""Test client session resumption using sync primitives for reliable coordination."""
11091111
_, server_url = event_server
11101112

0 commit comments

Comments
 (0)