Skip to content

Commit 6ca8593

Browse files
test: read the full event stream before asserting in the resubscription test (a2aproject#1406)
**What this changes** `test_task_resubscription` now reads the full SSE stream before asserting, instead of breaking out of the read loop after the first chunk. **Why** The test broke out of the loop as soon as it had read one SSE event, then asserted that the second and third artifact events were also present. That only holds when the first network read happens to contain every event. On platforms where the first read returns a single event, for example on Windows, `artifact-1` and `artifact-2` were not in the buffer yet and the assertions failed. Reproduced on Windows with Python 3.13: `test_task_resubscription` failed on every run before this change and passes on every run after it. The rest of `tests/server/test_integration.py` keeps passing (30 passed). **The fix** Drop the early break so the loop drains the stream, matching the sibling `test_message_send_stream`, which already reads to completion before asserting. The server behavior under test is unchanged; only the test's read loop changes. --------- Co-authored-by: mykytanetipa <mykytanetipa@google.com>
1 parent aa8e966 commit 6ca8593

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

‎tests/server/test_integration.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,6 @@ async def stream_generator():
682682
# A more robust check would be to parse each SSE event
683683
if b'data:' in chunk: # Naive check for SSE data lines
684684
event_count += 1
685-
if (
686-
event_count >= 1 and len(content) > 20
687-
): # Ensure we've processed at least one event
688-
break
689685

690686
# Check content has event data (e.g., part of the first event)
691687
assert b'artifact-0' in content # Check for the actual JSON payload

0 commit comments

Comments
 (0)