Loop handles CancelledError gracefully.
(self)
| 141 | |
| 142 | @pytest.mark.asyncio |
| 143 | async def test_handles_cancellation(self): |
| 144 | """Loop handles CancelledError gracefully.""" |
| 145 | ctx = _make_context() |
| 146 | ui = _make_ui() |
| 147 | q: asyncio.Queue = asyncio.Queue() |
| 148 | done = asyncio.Event() |
| 149 | |
| 150 | mock_convo = MagicMock() |
| 151 | mock_convo.process_conversation = AsyncMock( |
| 152 | side_effect=asyncio.CancelledError() |
| 153 | ) |
| 154 | |
| 155 | await q.put("do something") |
| 156 | |
| 157 | with patch( |
| 158 | "mcp_cli.chat.conversation.ConversationProcessor", |
| 159 | return_value=mock_convo, |
| 160 | ): |
| 161 | await run_agent_loop(ctx, ui, q, done) |
| 162 | |
| 163 | assert done.is_set() |
| 164 | |
| 165 | @pytest.mark.asyncio |
| 166 | async def test_handles_exception(self): |
nothing calls this directly
no test coverage detected