From 6fc5f688ec006b63672a458af148a16467f73c84 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Fri, 7 Nov 2025 09:04:35 -0800 Subject: [PATCH] Clean up tests --- tests/test_validation_error_context.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/test_validation_error_context.py b/tests/test_validation_error_context.py index 9ea395c089..844b8a64f9 100644 --- a/tests/test_validation_error_context.py +++ b/tests/test_validation_error_context.py @@ -98,15 +98,20 @@ def test_request_validation_error_includes_endpoint_context(): def test_response_validation_error_includes_endpoint_context(): + captured_exception.exception = None try: client.get("/items/") - except ResponseValidationError as exc: - error_str = str(exc) - assert "get_item" in error_str - assert "/items/" in error_str + except Exception: + pass + + assert captured_exception.exception is not None + error_str = str(captured_exception.exception) + assert "get_item" in error_str + assert "/items/" in error_str def test_websocket_validation_error_includes_endpoint_context(): + captured_exception.exception = None try: with client.websocket_connect("/ws/invalid"): pass # pragma: no cover