@@ -1802,7 +1802,7 @@ async def test_extensions_passed_to_streamablehttp_client(self, basic_server: No
18021802 # Create httpx client with extensions
18031803 custom_client = create_mcp_http_client ()
18041804 setattr (custom_client , "custom_extensions" , test_extensions )
1805-
1805+
18061806 async with custom_client :
18071807 async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client ) as (
18081808 read_stream ,
@@ -1825,9 +1825,13 @@ async def test_extensions_with_empty_dict(self, basic_server: None, basic_server
18251825 # Create httpx client with empty extensions
18261826 custom_client = create_mcp_http_client ()
18271827 setattr (custom_client , "custom_extensions" , {})
1828-
1828+
18291829 async with custom_client :
1830- async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client ) as (read_stream , write_stream , _ ):
1830+ async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client ) as (
1831+ read_stream ,
1832+ write_stream ,
1833+ _ ,
1834+ ):
18311835 async with ClientSession (read_stream , write_stream ) as session :
18321836 result = await session .initialize ()
18331837 assert isinstance (result , InitializeResult )
@@ -1837,9 +1841,13 @@ async def test_extensions_with_none(self, basic_server: None, basic_server_url:
18371841 """Test streamablehttp_client with None extensions (no custom_extensions attribute)."""
18381842 # Create httpx client without setting custom_extensions
18391843 custom_client = create_mcp_http_client ()
1840-
1844+
18411845 async with custom_client :
1842- async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client ) as (read_stream , write_stream , _ ):
1846+ async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client ) as (
1847+ read_stream ,
1848+ write_stream ,
1849+ _ ,
1850+ ):
18431851 async with ClientSession (read_stream , write_stream ) as session :
18441852 result = await session .initialize ()
18451853 assert isinstance (result , InitializeResult )
@@ -1904,7 +1912,7 @@ async def test_extensions_isolation_between_clients(self, basic_server: None, ba
19041912 # First client with extensions_1
19051913 custom_client1 = create_mcp_http_client ()
19061914 setattr (custom_client1 , "custom_extensions" , extensions_1 )
1907-
1915+
19081916 async with custom_client1 :
19091917 async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client1 ) as (
19101918 read_stream1 ,
@@ -1918,7 +1926,7 @@ async def test_extensions_isolation_between_clients(self, basic_server: None, ba
19181926 # Second client with extensions_2
19191927 custom_client2 = create_mcp_http_client ()
19201928 setattr (custom_client2 , "custom_extensions" , extensions_2 )
1921-
1929+
19221930 async with custom_client2 :
19231931 async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client2 ) as (
19241932 read_stream2 ,
@@ -1978,9 +1986,11 @@ async def stream(self, *args: Any, **kwargs: Any):
19781986 custom_client = ExtensionCapturingClient ()
19791987 setattr (custom_client , "custom_extensions" , test_extensions )
19801988
1981- async with streamable_http_client (
1982- f"{ basic_server_url } /mcp/" , http_client = custom_client
1983- ) as (read_stream , write_stream , _ ):
1989+ async with streamable_http_client (f"{ basic_server_url } /mcp/" , http_client = custom_client ) as (
1990+ read_stream ,
1991+ write_stream ,
1992+ _ ,
1993+ ):
19841994 async with ClientSession (read_stream , write_stream ) as session :
19851995 # Initialize - this should make a POST request with extensions
19861996 await session .initialize ()
@@ -2009,7 +2019,7 @@ async def test_extensions_with_json_and_sse_responses(self, basic_server: None,
20092019 # Create httpx client with extensions
20102020 custom_client = create_mcp_http_client ()
20112021 setattr (custom_client , "custom_extensions" , test_extensions )
2012-
2022+
20132023 # Test with regular SSE response (default behavior)
20142024 async with custom_client :
20152025 async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client ) as (
@@ -2039,7 +2049,7 @@ async def test_extensions_with_json_response_server(self, json_response_server:
20392049 # Create httpx client with extensions
20402050 custom_client = create_mcp_http_client ()
20412051 setattr (custom_client , "custom_extensions" , test_extensions )
2042-
2052+
20432053 async with custom_client :
20442054 async with streamable_http_client (f"{ json_server_url } /mcp" , http_client = custom_client ) as (
20452055 read_stream ,
@@ -2083,7 +2093,7 @@ async def test_extensions_with_special_characters(self, basic_server: None, basi
20832093 # Create httpx client with extensions
20842094 custom_client = create_mcp_http_client ()
20852095 setattr (custom_client , "custom_extensions" , test_extensions )
2086-
2096+
20872097 async with custom_client :
20882098 async with streamable_http_client (f"{ basic_server_url } /mcp" , http_client = custom_client ) as (
20892099 read_stream ,
0 commit comments