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.
This commit is contained in:
Yassin Kortam 2026-08-05 14:50:53 -07:00 committed by GitHub
parent 7984f4fa64
commit 87dbb632b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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: