Skip to content

Commit 7215444

Browse files
jgreer013claude
andcommitted
test(litellm): drop the passthrough test
It imported httpx at module top, which isn't installed in the common/gevent collection envs, breaking collection there. Maintainer preferred merging the fix without the test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1c9f092 commit 7215444

1 file changed

Lines changed: 0 additions & 56 deletions

File tree

tests/integrations/litellm/test_litellm.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from datetime import datetime
66
from unittest import mock
77

8-
import httpx
98
import pytest
109

1110
import sentry_sdk
@@ -2533,61 +2532,6 @@ def test_integration_setup(sentry_init):
25332532
assert _failure_callback in (litellm.failure_callback or [])
25342533

25352534

2536-
@pytest.mark.asyncio(loop_scope="session")
2537-
async def test_anthropic_passthrough_request_stays_serializable(
2538-
reset_litellm_executor, sentry_init
2539-
):
2540-
"""Regression test for GH-6596: litellm's Anthropic ``/v1/messages``
2541-
passthrough forwards the caller's ``metadata`` into the request body, so the
2542-
integration must not make that body unserializable. Drive the real
2543-
passthrough with a mocked transport and assert the request body serializes.
2544-
"""
2545-
sentry_init(
2546-
integrations=[LiteLLMIntegration()],
2547-
disabled_integrations=[StdlibIntegration],
2548-
traces_sample_rate=1.0,
2549-
send_default_pii=True,
2550-
)
2551-
2552-
captured = {}
2553-
anthropic_response = {
2554-
"id": "msg_1",
2555-
"type": "message",
2556-
"role": "assistant",
2557-
"content": [{"type": "text", "text": "Hi there"}],
2558-
"model": "claude-3-5-sonnet-latest",
2559-
"stop_reason": "end_turn",
2560-
"stop_sequence": None,
2561-
"usage": {"input_tokens": 1, "output_tokens": 1},
2562-
}
2563-
2564-
client = AsyncHTTPHandler()
2565-
2566-
def capture_post(*args, **kwargs):
2567-
captured["data"] = kwargs.get("data")
2568-
return httpx.Response(
2569-
200,
2570-
json=anthropic_response,
2571-
request=httpx.Request("POST", "https://api.anthropic.com/v1/messages"),
2572-
)
2573-
2574-
with mock.patch.object(client, "post", side_effect=capture_post), start_transaction(
2575-
name="litellm test"
2576-
):
2577-
await litellm.anthropic.messages.acreate(
2578-
model="anthropic/claude-3-5-sonnet-latest",
2579-
messages=[{"role": "user", "content": "Hello!"}],
2580-
max_tokens=16,
2581-
metadata={"user_id": "my-org"},
2582-
api_key="test-key",
2583-
client=client,
2584-
)
2585-
2586-
assert "data" in captured
2587-
request_body = json.loads(captured["data"])
2588-
assert request_body["metadata"] == {"user_id": "my-org"}
2589-
2590-
25912535
def test_litellm_message_truncation(sentry_init, capture_events):
25922536
"""Test that large messages are truncated properly in LiteLLM integration."""
25932537
sentry_init(

0 commit comments

Comments
 (0)