From b2ef9d5b64255d709227c07389a12fb3b57edd99 Mon Sep 17 00:00:00 2001 From: MHammett Date: Mon, 21 Sep 2026 05:12:49 -0500 Subject: [PATCH] test(responses): drop sys.path.insert from the response_format tests main's test-quality gate counts sys.path.insert under TQ003, and main is already over that rule's ceiling (63 against 62), so any new occurrence fails lint. The line was copied from the sibling text_format test, which main has since cleaned up the same way; pytest resolves litellm from the repo root without it. Also corrects a stale docstring: the helper raises litellm.BadRequestError directly, not ValueError. Co-Authored-By: Claude Opus 5 --- .../responses/test_response_format_conversion.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/test_litellm/responses/test_response_format_conversion.py b/tests/test_litellm/responses/test_response_format_conversion.py index e576980d3c0..2c8a4d4307f 100644 --- a/tests/test_litellm/responses/test_response_format_conversion.py +++ b/tests/test_litellm/responses/test_response_format_conversion.py @@ -11,15 +11,11 @@ These assert on the params that would be sent to the provider rather than on a successful return, because the call returned successfully in the broken case too. """ -import os -import sys from unittest.mock import patch import pytest from pydantic import BaseModel -sys.path.insert(0, os.path.abspath("../../..")) # Adds the parent directory to the system path - import litellm from litellm.types.llms.openai import ResponseAPIUsage, ResponsesAPIResponse @@ -188,8 +184,9 @@ def test_response_format_without_type_raises(bad_format): None would send the request unconstrained -- reintroducing, for malformed input, exactly the silent drop this conversion exists to remove. - The helper raises ValueError; responses() surfaces it through exception_type() as - BadRequestError, which is what a caller actually sees. + The helper raises litellm.BadRequestError directly: a bare ValueError would reach the + caller through exception_type() as APIConnectionError, reporting bad input as a + network fault. """ with pytest.raises(litellm.BadRequestError, match="Could not read a `type`"): _capture_request_params(response_format=bad_format)