Browse Source

Support Python 3.10 in stream validation tests

pull/15958/head
Saurabh 2 weeks ago
parent
commit
4f2d0aacc4
  1. 8
      tests/test_stream_response_validation_error.py

8
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")

Loading…
Cancel
Save