mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
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.
This commit is contained in:
parent
0bba7f8869
commit
5928556c16
1 changed files with 4 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue