mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
test: keep the Qwen brand missing-key tests off the network and split the ChatGPT fields test back out
This commit is contained in:
parent
cf00ab1bf8
commit
bd8df0ed8f
2 changed files with 16 additions and 3 deletions
|
|
@ -95,6 +95,13 @@ BRAND_CASES = [
|
|||
def clear_dashscope_family_env(monkeypatch):
|
||||
for env_var in DASHSCOPE_FAMILY_ENV_VARS:
|
||||
monkeypatch.delenv(env_var, raising=False)
|
||||
monkeypatch.setattr(litellm, "api_key", None)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def no_provider_traffic(respx_mock, monkeypatch):
|
||||
monkeypatch.setattr(litellm, "disable_aiohttp_transport", True)
|
||||
return respx_mock
|
||||
|
||||
|
||||
class TestQwenBrandProviderResolution:
|
||||
|
|
@ -267,22 +274,25 @@ class TestQwenBrandUserFacingNames:
|
|||
assert self.RETIRED_MAINLAND_NAME not in message
|
||||
|
||||
@pytest.mark.parametrize("brand", BRAND_CASES)
|
||||
def test_embedding_without_key_names_brand(self, brand):
|
||||
def test_embedding_without_key_names_brand(self, brand, no_provider_traffic):
|
||||
with pytest.raises(litellm.APIConnectionError, match=re.escape(brand["display_name"])) as exc_info:
|
||||
litellm.embedding(model=f"{brand['provider']}/text-embedding-v4", input=["hello"])
|
||||
assert self.RETIRED_MAINLAND_NAME not in str(exc_info.value)
|
||||
assert no_provider_traffic.calls.call_count == 0
|
||||
|
||||
@pytest.mark.parametrize("brand", BRAND_CASES)
|
||||
def test_rerank_without_key_names_brand(self, brand):
|
||||
def test_rerank_without_key_names_brand(self, brand, no_provider_traffic):
|
||||
with pytest.raises(litellm.APIConnectionError, match=re.escape(brand["display_name"])) as exc_info:
|
||||
litellm.rerank(model=f"{brand['provider']}/gte-rerank-v2", query="q", documents=["a", "b"])
|
||||
assert self.RETIRED_MAINLAND_NAME not in str(exc_info.value)
|
||||
assert no_provider_traffic.calls.call_count == 0
|
||||
|
||||
@pytest.mark.parametrize("brand", BRAND_CASES)
|
||||
def test_image_generation_without_key_names_brand(self, brand):
|
||||
def test_image_generation_without_key_names_brand(self, brand, no_provider_traffic):
|
||||
with pytest.raises(litellm.APIConnectionError, match=re.escape(brand["display_name"])) as exc_info:
|
||||
litellm.image_generation(model=f"{brand['provider']}/qwen-image", prompt="a cup of coffee")
|
||||
assert self.RETIRED_MAINLAND_NAME not in str(exc_info.value)
|
||||
assert no_provider_traffic.calls.call_count == 0
|
||||
|
||||
@pytest.mark.parametrize("brand", BRAND_CASES)
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
|
|
@ -357,6 +357,9 @@ def test_qwen_mainland_provider_fields_carry_the_qianwen_brand():
|
|||
assert mainland_fields["api_key"]["label"] == "Qianwen AI Platform API Key"
|
||||
assert "Qianwen AI Platform" in mainland_fields["api_base"]["tooltip"]
|
||||
assert "Qwen AI Platform" not in json.dumps(mainland)
|
||||
|
||||
|
||||
def test_chatgpt_provider_fields():
|
||||
app_instance = FastAPI()
|
||||
app_instance.include_router(router)
|
||||
test_client = TestClient(app_instance)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue