From 51743f490467cf4372be1dcc6300a82c07e2a42f Mon Sep 17 00:00:00 2001 From: kshitij <82637225+kshitijk4poor@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:04:24 +0530 Subject: [PATCH] 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. --- tests/providers/test_provider_registry.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/providers/test_provider_registry.py b/tests/providers/test_provider_registry.py index e97fd964fc..c31879dcba 100644 --- a/tests/providers/test_provider_registry.py +++ b/tests/providers/test_provider_registry.py @@ -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)