File tree Expand file tree Collapse file tree
src/google/adk/tools/mcp_tool
tests/unittests/tools/mcp_tool Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -347,8 +347,8 @@ async def _run(self):
347347
348348 # Wait for close signal - the session remains valid while we wait
349349 await self ._close_event .wait ()
350- except BaseException as e :
351- logger .warning (f 'Error on session runner task: { e } ' )
350+ except Exception as e :
351+ logger .warning ('Error on session runner task: %s' , e )
352352 raise
353353 finally :
354354 self ._ready_event .set ()
Original file line number Diff line number Diff line change @@ -609,9 +609,14 @@ async def test_close_handles_cancelled_error(self):
609609
610610 mock_session = MockClientSession ()
611611
612- with patch (
613- 'google.adk.tools.mcp_tool.session_context.ClientSession'
614- ) as mock_session_class :
612+ with (
613+ patch (
614+ 'google.adk.tools.mcp_tool.session_context.ClientSession'
615+ ) as mock_session_class ,
616+ patch (
617+ 'google.adk.tools.mcp_tool.session_context.logger'
618+ ) as mock_logger ,
619+ ):
615620 mock_session_class .return_value = mock_session
616621
617622 await session_context .start ()
@@ -626,6 +631,9 @@ async def test_close_handles_cancelled_error(self):
626631 # Should not raise exception
627632 assert session_context ._close_event .is_set ()
628633
634+ # Verify no warning logs were generated
635+ mock_logger .warning .assert_not_called ()
636+
629637 @pytest .mark .asyncio
630638 async def test_close_handles_exception_during_cleanup (self ):
631639 """Test that close() handles exceptions during cleanup gracefully."""
You can’t perform that action at this time.
0 commit comments