@@ -359,10 +359,10 @@ async def test_progress_callback_exception_logging():
359359 """Test that exceptions in progress callbacks are logged and \
360360 don't crash the session."""
361361 # Track logged warnings
362- logged_warnings = []
362+ logged_errors = []
363363
364- def mock_warning (msg , * args ):
365- logged_warnings .append (msg % args if args else msg )
364+ def mock_log_error (msg , * args ):
365+ logged_errors .append (msg % args if args else msg )
366366
367367 # Create a progress callback that raises an exception
368368 async def failing_progress_callback (
@@ -399,7 +399,7 @@ async def handle_list_tools() -> list[types.Tool]:
399399 ]
400400
401401 # Test with mocked logging
402- with patch ("mcp.shared.session.logging.warning " , side_effect = mock_warning ):
402+ with patch ("mcp.shared.session.logging.error " , side_effect = mock_log_error ):
403403 async with create_connected_server_and_client_session (server ) as client_session :
404404 # Send a request with a failing progress callback
405405 result = await client_session .send_request (
@@ -422,8 +422,8 @@ async def handle_list_tools() -> list[types.Tool]:
422422 assert content .text == "progress_result"
423423
424424 # Check that a warning was logged for the progress callback exception
425- assert len (logged_warnings ) > 0
425+ assert len (logged_errors ) > 0
426426 assert any (
427427 "Progress callback raised an exception" in warning
428- for warning in logged_warnings
428+ for warning in logged_errors
429429 )
0 commit comments