From 87dbb632b2c8a55bf8454b45eb80787673bf71f4 Mon Sep 17 00:00:00 2001 From: Yassin Kortam Date: Wed, 5 Aug 2026 14:50:53 -0700 Subject: [PATCH] test(utils): pin the register_model replay test to the recorded half (#35994) test_reapply_runtime_registrations_replays_register_model_overrides asserts that a fetched catalog value survives the replay for a key an operator override does not mention. Any Router still alive in the process re-asserts its own deployments first, so a router serving openai/gpt-4o writes its model_info over that catalog value and the assertion reads the router's number instead. Routers built by earlier tests stay in the weak set until they are collected, which made the test depend on collection timing and fail intermittently in shards that run the router tests alongside it. The live-router rebuild is covered in test_router_model_cost_isolation.py, so this test now runs with the replay callback unset and exercises the recorded registrations it is about. --- tests/test_litellm/test_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py index a8eb8b11974..e80960a22c9 100644 --- a/tests/test_litellm/test_utils.py +++ b/tests/test_litellm/test_utils.py @@ -5036,6 +5036,11 @@ def test_reapply_runtime_registrations_replays_register_model_overrides(monkeypa "_runtime_registered_model_cost", dict(litellm_utils._runtime_registered_model_cost), ) + # Only the recorded half is under test here; the live-router rebuild is covered + # in test_router_model_cost_isolation.py. Routers built by earlier tests in this + # process stay in the weak set until they are collected, so leaving the callback + # installed would make this depend on when that happens. + monkeypatch.setattr(litellm_utils._LiveDeploymentReplay, "callback", None) saved_model_cost = litellm.model_cost try: