From 5928556c1663dd88e31418da9d1a1583f3779a6e Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Fri, 28 Aug 2026 10:11:55 -0700 Subject: [PATCH] test: assert endpoint config freshness by identity instead of mutating it The previous check proved _load_endpoints_config returns a fresh object by clearing the first result and reloading. That mutates shared state and only works while the loader happens not to cache, so a future cache would corrupt every later test rather than fail this one. Compare the two loads by identity and equality instead. Verified red-before-green: adding a module-level cache to the loader fails this test, removing it passes. --- tests/test_litellm/containers/test_endpoint_factory.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_litellm/containers/test_endpoint_factory.py b/tests/test_litellm/containers/test_endpoint_factory.py index 46564bb1810..8de0d039afc 100644 --- a/tests/test_litellm/containers/test_endpoint_factory.py +++ b/tests/test_litellm/containers/test_endpoint_factory.py @@ -47,8 +47,10 @@ class TestEndpointsConfig: def test_config_is_reread_rather_than_shared_between_callers(self): first = _load_endpoints_config() - first["endpoints"].clear() - assert len(_load_endpoints_config()["endpoints"]) == len(_SYNC_NAMES) + second = _load_endpoints_config() + assert first is not second + assert first["endpoints"] is not second["endpoints"] + assert first == second class TestResponseTypeMapping: