mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-11 08:38:24 +00:00
test(openai): run the httpx2 error cases only on openai SDK 3
Some checks failed
Cost map pins recheck / rerun-cost-map-guard (push) Has been cancelled
LiteLLM Rust DB / db-queries (push) Has been cancelled
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Some checks failed
Cost map pins recheck / rerun-cost-map-guard (push) Has been cancelled
LiteLLM Rust DB / db-queries (push) Has been cancelled
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
This commit is contained in:
parent
943a96019e
commit
e949e94eb8
1 changed files with 14 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import importlib
|
|||
import json
|
||||
import os
|
||||
from collections.abc import AsyncIterator, Awaitable, Callable, Iterator, Mapping
|
||||
from importlib.metadata import version
|
||||
from types import ModuleType
|
||||
from typing import Final, Literal, Protocol
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
|
@ -472,6 +473,11 @@ async def test_mapped_error_carries_the_upstream_error_response(
|
|||
|
||||
|
||||
|
||||
_SDK_TAKES_HTTPX2: Final = pytest.mark.skipif(
|
||||
int(version("openai").split(".")[0]) < 3, reason="openai SDK 2 accepts only httpx clients"
|
||||
)
|
||||
|
||||
|
||||
def _sdk_default_transport_rejecting(_request: httpx2.Request) -> httpx2.Response:
|
||||
return httpx2.Response(
|
||||
400,
|
||||
|
|
@ -500,6 +506,7 @@ async def _acompletion_on_the_sdks_default_transport() -> None:
|
|||
await litellm.acompletion(messages=_MESSAGES, client=client, **_upstream("openai", "gpt-5.6"))
|
||||
|
||||
|
||||
@_SDK_TAKES_HTTPX2
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
"route",
|
||||
|
|
@ -607,7 +614,13 @@ def _httpx2_client_answering(status_code: int, body: str) -> httpx2.Client:
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("http_client_answering", (_httpx_client_answering, _httpx2_client_answering), ids=("httpx", "httpx2"))
|
||||
@pytest.mark.parametrize(
|
||||
"http_client_answering",
|
||||
(
|
||||
pytest.param(_httpx_client_answering, id="httpx"),
|
||||
pytest.param(_httpx2_client_answering, id="httpx2", marks=_SDK_TAKES_HTTPX2),
|
||||
),
|
||||
)
|
||||
@pytest.mark.parametrize("provider", ("openai", "litellm_proxy"))
|
||||
@pytest.mark.parametrize(
|
||||
("status_code", "mapped_error", "body"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue