Loop handles unexpected exceptions.
(self)
| 164 | |
| 165 | @pytest.mark.asyncio |
| 166 | async def test_handles_exception(self): |
| 167 | """Loop handles unexpected exceptions.""" |
| 168 | ctx = _make_context() |
| 169 | ui = _make_ui() |
| 170 | q: asyncio.Queue = asyncio.Queue() |
| 171 | done = asyncio.Event() |
| 172 | |
| 173 | mock_convo = MagicMock() |
| 174 | mock_convo.process_conversation = AsyncMock(side_effect=RuntimeError("boom")) |
| 175 | |
| 176 | await q.put("do something") |
| 177 | |
| 178 | with patch( |
| 179 | "mcp_cli.chat.conversation.ConversationProcessor", |
| 180 | return_value=mock_convo, |
| 181 | ): |
| 182 | result = await run_agent_loop(ctx, ui, q, done) |
| 183 | |
| 184 | assert done.is_set() |
| 185 | assert "Error" in result |
| 186 | |
| 187 | @pytest.mark.asyncio |
| 188 | async def test_exit_requested_stops_loop(self): |
nothing calls this directly
no test coverage detected