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 <noreply@anthropic.com>
This commit is contained in:
MHammett 2026-09-21 05:12:49 -05:00
parent bb304c8f35
commit b2ef9d5b64

View file

@ -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)