From 3c9c860de7ac98ab93c570ddd0313ee7d7b4d7a9 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Sat, 19 Sep 2026 14:16:52 -0700 Subject: [PATCH] test(proxy): set the unsafe-proxy override at the remaining test boot sites and isolate the boot test from a leaked scheduler --- tests/mcp_tests/test_proxy_mcp_e2e.py | 1 + tests/test_litellm/proxy/conftest.py | 1 + tests/test_litellm/proxy/test_proxy_server.py | 2 ++ 3 files changed, 4 insertions(+) diff --git a/tests/mcp_tests/test_proxy_mcp_e2e.py b/tests/mcp_tests/test_proxy_mcp_e2e.py index 99c03b3438d..9e3e421b4dd 100644 --- a/tests/mcp_tests/test_proxy_mcp_e2e.py +++ b/tests/mcp_tests/test_proxy_mcp_e2e.py @@ -54,6 +54,7 @@ def _clear_proxy_database_env() -> typing.Iterator[None]: # the LITELLM_MASTER_KEY env var, overriding whatever initialize() set from # the config file. We must set it here so the lifespan doesn't reset it to None. mp.setenv("LITELLM_MASTER_KEY", "sk-1234") + mp.setenv("LITELLM_DANGEROUSLY_ALLOW_UNSAFE_PROXY", "true") try: yield finally: diff --git a/tests/test_litellm/proxy/conftest.py b/tests/test_litellm/proxy/conftest.py index 65e12b7d777..b31d2229466 100644 --- a/tests/test_litellm/proxy/conftest.py +++ b/tests/test_litellm/proxy/conftest.py @@ -268,6 +268,7 @@ def create_proxy_test_client( # Set environment variables set_proxy_environment_variables(monkeypatch, database_url=database_url) + monkeypatch.setenv("LITELLM_DANGEROUSLY_ALLOW_UNSAFE_PROXY", "true") # Initialize proxy asyncio.run(initialize(config=config_fp, debug=init_options.get("debug", False))) diff --git a/tests/test_litellm/proxy/test_proxy_server.py b/tests/test_litellm/proxy/test_proxy_server.py index 07a07a25764..a670f467619 100644 --- a/tests/test_litellm/proxy/test_proxy_server.py +++ b/tests/test_litellm/proxy/test_proxy_server.py @@ -1636,6 +1636,8 @@ def _boot_with_general_settings(monkeypatch, tmp_path, general_settings): for name in ("LITELLM_MASTER_KEY", "LITELLM_DANGEROUSLY_ALLOW_UNSAFE_PROXY", "WORKER_CONFIG", "DATABASE_URL"): monkeypatch.delenv(name, raising=False) monkeypatch.setenv("CONFIG_FILE_PATH", str(config_path)) + scheduler_left_on_a_closed_event_loop_by_an_earlier_test = "litellm.proxy.proxy_server.scheduler" + monkeypatch.setattr(scheduler_left_on_a_closed_event_loop_by_an_earlier_test, None) announced = [] monkeypatch.setattr("litellm.proxy.proxy_server.announce_on_stderr_at_exit", announced.append) return config_path, announced