From 4f2d0aacc42a3510f277eb22ae50d35efbf697e1 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 8 Jul 2026 14:35:25 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Support=20Python=203.10=20in=20stre?= =?UTF-8?q?am=20validation=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_stream_response_validation_error.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_stream_response_validation_error.py b/tests/test_stream_response_validation_error.py index fee387298..d6e0885dd 100644 --- a/tests/test_stream_response_validation_error.py +++ b/tests/test_stream_response_validation_error.py @@ -19,6 +19,12 @@ import logging from collections.abc import AsyncIterable, Iterable import pytest + +try: + from builtins import ExceptionGroup +except ImportError: # pragma: no cover + from exceptiongroup import ExceptionGroup + from fastapi import FastAPI from fastapi.exceptions import ResponseValidationError from fastapi.responses import EventSourceResponse @@ -234,7 +240,7 @@ def test_sse_invalid_item_propagates(raising_client: TestClient): wrapped in an ExceptionGroup when it escapes the group boundary. """ # anyio task group wraps the sub-task exception in an ExceptionGroup - with pytest.raises((ResponseValidationError, ExceptionGroup)): # type: ignore[name-defined] # noqa: F821 + with pytest.raises((ResponseValidationError, ExceptionGroup)): raising_client.get("/sse/invalid")