From e81224d322ea45ac6e6ef52ebf8fddbe25c9be05 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Tue, 24 Mar 2026 20:41:46 +0530 Subject: [PATCH] fix(tests): reset module-level cache in stale alias bypass tests Reset _ENABLE_TEAM_STALE_ALIAS_BYPASS to None in both test functions to ensure test isolation and prevent ordering-dependent failures Made-with: Cursor --- tests/proxy_unit_tests/test_proxy_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/proxy_unit_tests/test_proxy_utils.py b/tests/proxy_unit_tests/test_proxy_utils.py index 9bfb466c0eb..6c6ec7bcd60 100644 --- a/tests/proxy_unit_tests/test_proxy_utils.py +++ b/tests/proxy_unit_tests/test_proxy_utils.py @@ -2046,7 +2046,11 @@ def test_update_model_if_team_alias_exists(data, user_api_key_dict, expected_mod def test_team_alias_stale_bypass_disabled_by_default(monkeypatch): monkeypatch.delenv("LITELLM_ENABLE_TEAM_STALE_ALIAS_BYPASS", raising=False) + import litellm.proxy.litellm_pre_call_utils as pre_call_utils from litellm.proxy.litellm_pre_call_utils import _update_model_if_team_alias_exists + + # Reset module-level cache to ensure test isolation + pre_call_utils._ENABLE_TEAM_STALE_ALIAS_BYPASS = None class _MockRouter: team_model_to_deployment_indices = {("team-1", "gpt-4o"): [0]} @@ -2067,7 +2071,11 @@ def test_team_alias_stale_bypass_disabled_by_default(monkeypatch): def test_team_alias_stale_bypass_enabled_by_flag(monkeypatch): + import litellm.proxy.litellm_pre_call_utils as pre_call_utils from litellm.proxy.litellm_pre_call_utils import _update_model_if_team_alias_exists + + # Reset module-level cache to ensure test isolation + pre_call_utils._ENABLE_TEAM_STALE_ALIAS_BYPASS = None class _MockRouter: team_model_to_deployment_indices = {("team-1", "gpt-4o"): [0]}