test: pin the hit-path copy guard on the provider snapshot cache

The existing test only mutated the miss-path return; a mutation to
'return _PROVIDER_LIST_CACHE' (aliasing the global cache) survived the
suite. One line pins the cached-return copy. Mutation-checked.
This commit is contained in:
kshitij
2026-08-03 17:04:24 +05:30
parent d0be609147
commit 51743f4904

View File

@@ -46,6 +46,11 @@ def test_list_providers_reuses_cached_snapshot_until_registration_changes():
assert providers.list_providers() == [first]
# Hit-path copy guard: mutating a CACHED return must not corrupt the
# module-level snapshot for later callers (aliasing bug class).
providers.list_providers().clear()
assert providers.list_providers() == [first]
second = _profile("beta")
providers.register_provider(second)