Skip to content

Commit c1d59c3

Browse files
committed
Adjust tests to check for logger.exception
1 parent 98a5083 commit c1d59c3

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

tests/server/tasks/test_inmemory_push_notifications.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,13 @@ async def test_send_notification_http_status_error(
220220
await self.notifier.send_notification(task_data) # Pass only task_data
221221

222222
self.mock_httpx_client.post.assert_awaited_once()
223-
mock_logger.error.assert_called_once()
223+
mock_logger.exception.assert_called_once()
224224
# Check that the error message contains the generic part and the specific exception string
225225
self.assertIn(
226-
'Error sending push-notification', mock_logger.error.call_args[0][0]
226+
'Error sending push-notification',
227+
mock_logger.exception.call_args[0][0],
227228
)
228-
self.assertIn(str(http_error), mock_logger.error.call_args[0][0])
229+
self.assertIn(str(http_error), mock_logger.exception.call_args[0][0])
229230

230231
@patch('a2a.server.tasks.base_push_notification_sender.logger')
231232
async def test_send_notification_request_error(
@@ -242,11 +243,12 @@ async def test_send_notification_request_error(
242243
await self.notifier.send_notification(task_data) # Pass only task_data
243244

244245
self.mock_httpx_client.post.assert_awaited_once()
245-
mock_logger.error.assert_called_once()
246+
mock_logger.exception.assert_called_once()
246247
self.assertIn(
247-
'Error sending push-notification', mock_logger.error.call_args[0][0]
248+
'Error sending push-notification',
249+
mock_logger.exception.call_args[0][0],
248250
)
249-
self.assertIn(str(request_error), mock_logger.error.call_args[0][0])
251+
self.assertIn(str(request_error), mock_logger.exception.call_args[0][0])
250252

251253
@patch('a2a.server.tasks.base_push_notification_sender.logger')
252254
async def test_send_notification_with_auth(self, mock_logger: MagicMock):

tests/server/tasks/test_push_notification_sender.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ async def test_send_notification_http_status_error(
123123
json=task_data.model_dump(mode='json', exclude_none=True),
124124
headers=None,
125125
)
126-
mock_logger.error.assert_called_once()
126+
mock_logger.exception.assert_called_once()
127127

128128
async def test_send_notification_multiple_configs(self):
129129
task_id = 'task_multiple_configs'

tests/utils/test_telemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def foo() -> int:
7878
return 1
7979

8080
foo()
81-
logger.error.assert_any_call(mock.ANY)
81+
logger.exception.assert_any_call(mock.ANY)
8282

8383

8484
@pytest.mark.asyncio

0 commit comments

Comments
 (0)