From 323aed7211b93df4095e4a1de47b119d916355f6 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 18 Feb 2026 18:20:32 -0800 Subject: [PATCH] fix: CI failures - missing env key doc + streaming test (#21510) * docs: add DATABRICKS_API_KEY to environment settings reference * fix: streaming test usage check on Pydantic model * fix: mock litellm.proxy.proxy_server in test_skip_server_startup --- docs/my-website/docs/proxy/config_settings.md | 1 + tests/local_testing/test_streaming.py | 6 +++--- tests/test_litellm/proxy/test_proxy_cli.py | 17 +++++++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index 55a99f7112..9e3b5e9097 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -494,6 +494,7 @@ router_settings: | DATABASE_USER | Username for database connection | DATABASE_USERNAME | Alias for database user | DATABRICKS_API_BASE | Base URL for Databricks API +| DATABRICKS_API_KEY | API key (Personal Access Token) for Databricks API authentication | DATABRICKS_CLIENT_ID | Client ID for Databricks OAuth M2M authentication (Service Principal application ID) | DATABRICKS_CLIENT_SECRET | Client secret for Databricks OAuth M2M authentication | DATABRICKS_USER_AGENT | Custom user agent string for Databricks API requests. Used for partner telemetry attribution diff --git a/tests/local_testing/test_streaming.py b/tests/local_testing/test_streaming.py index 00732a12cf..ee208b5e0e 100644 --- a/tests/local_testing/test_streaming.py +++ b/tests/local_testing/test_streaming.py @@ -76,7 +76,7 @@ def validate_first_format(chunk): assert isinstance(chunk["created"], int), "'created' should be an integer." assert isinstance(chunk["model"], str), "'model' should be a string." assert isinstance(chunk["choices"], list), "'choices' should be a list." - assert not hasattr(chunk, "usage"), "Chunk cannot contain usage" + assert getattr(chunk, "usage", None) is None, "Chunk cannot contain usage" for choice in chunk["choices"]: assert isinstance(choice["index"], int), "'index' should be an integer." @@ -108,7 +108,7 @@ def validate_second_format(chunk): assert isinstance(chunk["created"], int), "'created' should be an integer." assert isinstance(chunk["model"], str), "'model' should be a string." assert isinstance(chunk["choices"], list), "'choices' should be a list." - assert not hasattr(chunk, "usage"), "Chunk cannot contain usage" + assert getattr(chunk, "usage", None) is None, "Chunk cannot contain usage" for choice in chunk["choices"]: assert isinstance(choice["index"], int), "'index' should be an integer." @@ -146,7 +146,7 @@ def validate_last_format(chunk): assert isinstance(chunk["created"], int), "'created' should be an integer." assert isinstance(chunk["model"], str), "'model' should be a string." assert isinstance(chunk["choices"], list), "'choices' should be a list." - assert not hasattr(chunk, "usage"), "Chunk cannot contain usage" + assert getattr(chunk, "usage", None) is None, "Chunk cannot contain usage" for choice in chunk["choices"]: assert isinstance(choice["index"], int), "'index' should be an integer." diff --git a/tests/test_litellm/proxy/test_proxy_cli.py b/tests/test_litellm/proxy/test_proxy_cli.py index a18c2dba03..543547943d 100644 --- a/tests/test_litellm/proxy/test_proxy_cli.py +++ b/tests/test_litellm/proxy/test_proxy_cli.py @@ -233,15 +233,20 @@ class TestProxyInitializationHelpers: runner = CliRunner() + mock_proxy_module = MagicMock( + app=MagicMock(), + ProxyConfig=MagicMock(), + KeyManagementSettings=MagicMock(), + save_worker_config=MagicMock(), + ) with patch.dict( "sys.modules", { - "proxy_server": MagicMock( - app=MagicMock(), - ProxyConfig=MagicMock(), - KeyManagementSettings=MagicMock(), - save_worker_config=MagicMock(), - ) + "proxy_server": mock_proxy_module, + # Prevent real import of proxy_server inside Click's + # isolation context (heavy side effects cause stream + # lifecycle issues with Click 8.2+) + "litellm.proxy.proxy_server": mock_proxy_module, }, ), patch( "litellm.proxy.proxy_cli.ProxyInitializationHelpers._get_default_unvicorn_init_args"