Skip to content

Commit 824a5f4

Browse files
committed
Add sse-starlette test fix
1 parent 095b802 commit 824a5f4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/server/test_streamable_http_manager.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,21 @@ async def mock_receive():
318318
assert error_data["error"]["message"] == "Session not found"
319319

320320

321+
@pytest.fixture
322+
def reset_sse_app_status():
323+
# Needed for tests with sse-starlette < 3
324+
# https://github.com/sysid/sse-starlette/issues/59
325+
# https://github.com/sysid/sse-starlette/blob/v3.2.0/README.md#testing
326+
327+
from sse_starlette.sse import AppStatus
328+
329+
AppStatus.should_exit_event = None # pyright: ignore[reportAttributeAccessIssue]
330+
yield
331+
AppStatus.should_exit_event = None # pyright: ignore[reportAttributeAccessIssue]
332+
333+
321334
@pytest.mark.anyio
322-
async def test_e2e_streamable_http_server_cleanup():
335+
async def test_e2e_streamable_http_server_cleanup(reset_sse_app_status: None):
323336
host = "testserver"
324337
app = Server("test-server")
325338

0 commit comments

Comments
 (0)