Skip to content

Commit 94d3902

Browse files
committed
Revert "Revert fix to ensure tests catches the issue"
This reverts commit 39e2f87.
1 parent 39e2f87 commit 94d3902

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/a2a/client/transports/http_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import httpx
88

9-
from httpx_sse import EventSource, SSEError, aconnect_sse
9+
from httpx_sse import EventSource, SSEError
1010

1111
from a2a.client.client import ClientCallContext
1212
from a2a.client.errors import A2AClientError, A2AClientTimeoutError
@@ -75,7 +75,7 @@ async def send_http_stream_request(
7575
) -> AsyncGenerator[str]:
7676
"""Sends a streaming HTTP request, yielding SSE data strings and handling exceptions."""
7777
with handle_http_exceptions(status_error_handler):
78-
async with aconnect_sse(
78+
async with _SSEEventSource(
7979
httpx_client, method, url, **kwargs
8080
) as event_source:
8181
try:

tests/client/transports/test_jsonrpc_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ async def test_close(self, transport, mock_httpx_client):
433433

434434
class TestStreamingErrors:
435435
@pytest.mark.asyncio
436-
@patch('a2a.client.transports.http_helpers.aconnect_sse')
436+
@patch('a2a.client.transports.http_helpers._SSEEventSource')
437437
async def test_send_message_streaming_sse_error(
438438
self,
439439
mock_aconnect_sse: AsyncMock,
@@ -457,7 +457,7 @@ async def test_send_message_streaming_sse_error(
457457
pass
458458

459459
@pytest.mark.asyncio
460-
@patch('a2a.client.transports.http_helpers.aconnect_sse')
460+
@patch('a2a.client.transports.http_helpers._SSEEventSource')
461461
async def test_send_message_streaming_request_error(
462462
self,
463463
mock_aconnect_sse: AsyncMock,
@@ -483,7 +483,7 @@ async def test_send_message_streaming_request_error(
483483
pass
484484

485485
@pytest.mark.asyncio
486-
@patch('a2a.client.transports.http_helpers.aconnect_sse')
486+
@patch('a2a.client.transports.http_helpers._SSEEventSource')
487487
async def test_send_message_streaming_timeout(
488488
self,
489489
mock_aconnect_sse: AsyncMock,
@@ -560,7 +560,7 @@ async def test_extensions_added_to_request(
560560
)
561561

562562
@pytest.mark.asyncio
563-
@patch('a2a.client.transports.http_helpers.aconnect_sse')
563+
@patch('a2a.client.transports.http_helpers._SSEEventSource')
564564
async def test_send_message_streaming_server_error_propagates(
565565
self,
566566
mock_aconnect_sse: AsyncMock,

tests/client/transports/test_rest_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _assert_extensions_header(mock_kwargs: dict, expected_extensions: set[str]):
7070

7171
class TestRestTransport:
7272
@pytest.mark.asyncio
73-
@patch('a2a.client.transports.http_helpers.aconnect_sse')
73+
@patch('a2a.client.transports.http_helpers._SSEEventSource')
7474
async def test_send_message_streaming_timeout(
7575
self,
7676
mock_aconnect_sse: AsyncMock,
@@ -280,7 +280,7 @@ async def test_send_message_with_default_extensions(
280280
)
281281

282282
@pytest.mark.asyncio
283-
@patch('a2a.client.transports.http_helpers.aconnect_sse')
283+
@patch('a2a.client.transports.http_helpers._SSEEventSource')
284284
async def test_send_message_streaming_with_new_extensions(
285285
self,
286286
mock_aconnect_sse: AsyncMock,
@@ -329,7 +329,7 @@ async def test_send_message_streaming_with_new_extensions(
329329
)
330330

331331
@pytest.mark.asyncio
332-
@patch('a2a.client.transports.http_helpers.aconnect_sse')
332+
@patch('a2a.client.transports.http_helpers._SSEEventSource')
333333
async def test_send_message_streaming_server_error_propagates(
334334
self,
335335
mock_aconnect_sse: AsyncMock,
@@ -693,7 +693,7 @@ async def test_rest_get_task_prepend_empty_tenant(
693693
],
694694
)
695695
@pytest.mark.asyncio
696-
@patch('a2a.client.transports.http_helpers.aconnect_sse')
696+
@patch('a2a.client.transports.http_helpers._SSEEventSource')
697697
async def test_rest_streaming_methods_prepend_tenant( # noqa: PLR0913
698698
self,
699699
mock_aconnect_sse,

0 commit comments

Comments
 (0)