Merge pull request #19585 from BerriAI/litellm_cicd_fix_yj_015

[Infra] CI/CD - Fix Non Root Proxy Tests
This commit is contained in:
yuneng-jiang 2026-01-22 11:31:50 -08:00 • committed by GitHub
commit 5c29eeea30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,8 +17,13 @@ def test_restructure_ui_html_files_skipped_in_non_root(monkeypatch):
ui_path = "/var/lib/litellm/ui"
# Mock the _restructure_ui_html_files function to check if it's called
# Use create=True to allow patching even if the module hasn't been imported yet
# or if the function doesn't exist (it's defined inside a try/except block)
# spec=False prevents spec checking which can fail during import resolution
with patch(
"litellm.proxy.proxy_server._restructure_ui_html_files"
"litellm.proxy.proxy_server._restructure_ui_html_files",
create=True,
spec=False,
) as mock_restructure:
# Simulate the logic we added in proxy_server.py
if is_non_root and ui_path == "/var/lib/litellm/ui":
@ -40,8 +45,13 @@ def test_restructure_ui_html_files_NOT_skipped_locally(monkeypatch):
is_non_root = False
ui_path = "/some/local/path"
# Use create=True and spec=False to allow patching even if the module hasn't been imported yet
# or if the function doesn't exist (it's defined inside a try/except block)
# spec=False prevents spec checking which can fail during import resolution
with patch(
"litellm.proxy.proxy_server._restructure_ui_html_files"
"litellm.proxy.proxy_server._restructure_ui_html_files",
create=True,
spec=False,
) as mock_restructure:
if is_non_root and ui_path == "/var/lib/litellm/ui":
pass