From 86c8f0c7f8112f4c8a89391ea538fa0615b80676 Mon Sep 17 00:00:00 2001 From: guillaume blaquiere Date: Mon, 1 Dec 2025 23:40:21 +0100 Subject: [PATCH 1/3] fix: issue 3772. Remove not understood check without any callback_context taken into account. --- src/google/adk/auth/credential_manager.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/google/adk/auth/credential_manager.py b/src/google/adk/auth/credential_manager.py index c022ab694c..789870f0c6 100644 --- a/src/google/adk/auth/credential_manager.py +++ b/src/google/adk/auth/credential_manager.py @@ -182,10 +182,6 @@ async def _load_existing_credential( if credential: return credential - # Check if we have a cached exchanged credential - if self._auth_config.exchanged_auth_credential: - return self._auth_config.exchanged_auth_credential - return None async def _load_from_credential_service( From cd9795d8ee6f599546deaa61261435977d36255e Mon Sep 17 00:00:00 2001 From: guillaume blaquiere Date: Thu, 4 Dec 2025 21:15:16 +0100 Subject: [PATCH 2/3] fix: irrelevant test because the exchanged cache has been removed --- tests/unittests/auth/test_credential_manager.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tests/unittests/auth/test_credential_manager.py b/tests/unittests/auth/test_credential_manager.py index ab021d1eaa..e7bea80a54 100644 --- a/tests/unittests/auth/test_credential_manager.py +++ b/tests/unittests/auth/test_credential_manager.py @@ -131,22 +131,6 @@ async def test_load_auth_credentials_no_credential(self): assert result is None - @pytest.mark.asyncio - async def test_load_existing_credential_already_exchanged(self): - """Test _load_existing_credential when credential is already exchanged.""" - auth_config = Mock(spec=AuthConfig) - mock_credential = Mock(spec=AuthCredential) - auth_config.exchanged_auth_credential = mock_credential - - callback_context = Mock() - - manager = CredentialManager(auth_config) - manager._load_from_credential_service = AsyncMock(return_value=None) - - result = await manager._load_existing_credential(callback_context) - - assert result == mock_credential - @pytest.mark.asyncio async def test_load_existing_credential_with_credential_service(self): """Test _load_existing_credential with credential service.""" From a82d190db9e2a45fae35b53e35a1910d5347c373 Mon Sep 17 00:00:00 2001 From: guillaume blaquiere Date: Sat, 24 Jan 2026 22:55:11 +0100 Subject: [PATCH 3/3] chore: fix unit test --- pyproject.toml | 1 + tests/unittests/agents/test_remote_a2a_agent.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1af967046f..01b7407d5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -207,6 +207,7 @@ known_third_party = ["google.adk"] [tool.pytest.ini_options] testpaths = ["tests"] +pythonpath = "src" asyncio_default_fixture_loop_scope = "function" asyncio_mode = "auto" diff --git a/tests/unittests/agents/test_remote_a2a_agent.py b/tests/unittests/agents/test_remote_a2a_agent.py index 6a098dff9a..7720e199b4 100644 --- a/tests/unittests/agents/test_remote_a2a_agent.py +++ b/tests/unittests/agents/test_remote_a2a_agent.py @@ -17,6 +17,7 @@ import tempfile from unittest.mock import AsyncMock from unittest.mock import create_autospec +from unittest.mock import MagicMock from unittest.mock import Mock from unittest.mock import patch @@ -1002,7 +1003,7 @@ async def test_handle_a2a_response_with_task_submitted_and_no_update(self): mock_a2a_task, self.agent.name, self.mock_context, - self.mock_a2a_part_converter, + self.agent._a2a_part_converter, ) # Check the parts are updated as Thought assert result.content.parts[0].thought is True @@ -1770,7 +1771,7 @@ async def test_run_async_impl_successful_request(self): ) # Tuple with parts and context_id # Mock A2A client - mock_a2a_client = create_autospec(spec=A2AClient, instance=True) + mock_a2a_client = MagicMock(spec=A2AClient) mock_response = Mock() mock_send_message = AsyncMock() mock_send_message.__aiter__.return_value = [mock_response] @@ -1909,7 +1910,7 @@ async def test_run_async_impl_with_meta_provider(self): ) # Tuple with parts and context_id # Mock A2A client - mock_a2a_client = create_autospec(spec=A2AClient, instance=True) + mock_a2a_client = MagicMock(spec=A2AClient) mock_response = Mock() mock_send_message = AsyncMock() mock_send_message.__aiter__.return_value = [mock_response] @@ -2046,7 +2047,7 @@ async def test_run_async_impl_successful_request(self): ) # Tuple with parts and context_id # Mock A2A client - mock_a2a_client = create_autospec(spec=A2AClient, instance=True) + mock_a2a_client = MagicMock(spec=A2AClient) mock_response = Mock() mock_send_message = AsyncMock() mock_send_message.__aiter__.return_value = [mock_response]