Skip to content

Commit 2c63020

Browse files
committed
fix test
1 parent 8194bce commit 2c63020

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

tests/shared/test_sse.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,22 @@ async def http_client(server, server_url) -> AsyncGenerator[httpx.AsyncClient, N
161161
@pytest.mark.anyio
162162
async def test_raw_sse_connection(http_client: httpx.AsyncClient) -> None:
163163
"""Test the SSE connection establishment simply with an HTTP client."""
164-
with anyio.fail_after(10):
165-
async with http_client.stream("GET", "/sse") as response:
166-
assert response.status_code == 200
167-
assert (
168-
response.headers["content-type"]
169-
== "text/event-stream; charset=utf-8"
170-
)
164+
async with http_client.stream("GET", "/sse", timeout=5) as response:
165+
assert response.status_code == 200
166+
assert (
167+
response.headers["content-type"]
168+
== "text/event-stream; charset=utf-8"
169+
)
171170

172-
line_number = 0
173-
async for line in response.aiter_lines():
174-
if line_number == 0:
175-
assert line == "event: endpoint"
176-
elif line_number == 1:
177-
assert line.startswith("data: /messages/?session_id=")
178-
else:
179-
return
180-
line_number += 1
171+
line_number = 0
172+
async for line in response.aiter_lines():
173+
if line_number == 0:
174+
assert line == "event: endpoint"
175+
elif line_number == 1:
176+
assert line.startswith("data: /messages/?session_id=")
177+
else:
178+
return
179+
line_number += 1
181180

182181

183182
@pytest.mark.anyio

0 commit comments

Comments
 (0)