@@ -648,3 +648,40 @@ def test_format_files_for_input_pretty_true_mixed_files(
648648 args_ed , _ = mock_columns .call_args_list [2 ]
649649 renderables_ed = args_ed [0 ]
650650 assert renderables_ed == ["Editable:" , "edit1.txt" , "edit[markup].txt" ]
651+ import asyncio
652+ from unittest .mock import MagicMock , patch
653+
654+ import pytest
655+
656+ from cecli .io import InputOutput
657+
658+
659+ @pytest .mark .asyncio
660+ async def test_notification_suppressed_during_processing ():
661+ """
662+ Verify that notifications are not sent when a prompt is being processed.
663+ """
664+ # Initialize InputOutput with notifications enabled
665+ io = InputOutput (notifications = True )
666+ io .is_processing_prompt = False # Start in idle state
667+
668+ with patch .object (io , "_send_notification" ) as mock_send_notification :
669+ # 1. Test when idle: notification should be sent
670+ io .notify_user_input_required ()
671+ mock_send_notification .assert_called_once ()
672+
673+ # Reset mock for the next check
674+ mock_send_notification .reset_mock ()
675+
676+ # 2. Test when processing: notification should be suppressed
677+ io .is_processing_prompt = True
678+ io .notify_user_input_required ()
679+ mock_send_notification .assert_not_called ()
680+
681+ # Reset mock for the next check
682+ mock_send_notification .reset_mock ()
683+
684+ # 3. Test after processing: notification should be sent again
685+ io .is_processing_prompt = False
686+ io .notify_user_input_required ()
687+ mock_send_notification .assert_called_once ()
0 commit comments