From c2c73605e04f4ea4c578ebb5dc2880803853c368 Mon Sep 17 00:00:00 2001 From: isheng Date: Tue, 7 Jul 2026 13:38:56 +0800 Subject: [PATCH] test: set pool.provider= on mocks to avoid MagicMock truthy guard trigger The provider-mismatch guard now checks pool_provider and current_provider != pool_provider. MagicMock.provider returns a truthy child mock by default, which would trigger the guard and skip the pool recovery tests. Set pool.provider='' explicitly. --- tests/agent/test_credential_pool_routing.py | 3 +++ tests/run_agent/test_credential_pool_interrupt.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tests/agent/test_credential_pool_routing.py b/tests/agent/test_credential_pool_routing.py index 8477fdb646a..9c7c0473051 100644 --- a/tests/agent/test_credential_pool_routing.py +++ b/tests/agent/test_credential_pool_routing.py @@ -155,6 +155,9 @@ class TestPoolRotationCycle: pool = MagicMock() pool.has_credentials.return_value = True + # Must be set explicitly — MagicMock.provider returns a truthy + # child mock, which would trigger the provider-mismatch guard. + pool.provider = "" # mark_exhausted_and_rotate returns next entry until exhausted self._rotation_index = 0 diff --git a/tests/run_agent/test_credential_pool_interrupt.py b/tests/run_agent/test_credential_pool_interrupt.py index 8dab8da949a..19e68e1c61c 100644 --- a/tests/run_agent/test_credential_pool_interrupt.py +++ b/tests/run_agent/test_credential_pool_interrupt.py @@ -27,6 +27,9 @@ def _make_pool(entries): pool = MagicMock() pool.entries = entries pool.current.return_value = entries[0] + # Must be set explicitly — MagicMock.provider returns a truthy + # child mock, which would trigger the provider-mismatch guard. + pool.provider = "" return pool