MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_processes_prompt

Method test_processes_prompt

tests/agents/test_loop.py:93–114  ·  view source on GitHub ↗

Loop processes a normal prompt via ConversationProcessor.

(self)

Source from the content-addressed store, hash-verified

91
92 @pytest.mark.asyncio
93 async def test_processes_prompt(self):
94 """Loop processes a normal prompt via ConversationProcessor."""
95 ctx = _make_context()
96 ui = _make_ui()
97 q: asyncio.Queue = asyncio.Queue()
98 done = asyncio.Event()
99
100 await q.put("Hello agent")
101 await q.put("exit")
102
103 mock_convo = MagicMock()
104 mock_convo.process_conversation = AsyncMock()
105
106 with patch(
107 "mcp_cli.chat.conversation.ConversationProcessor",
108 return_value=mock_convo,
109 ):
110 await run_agent_loop(ctx, ui, q, done)
111
112 ctx.add_user_message.assert_called_once_with("Hello agent")
113 mock_convo.process_conversation.assert_called_once()
114 assert done.is_set()
115
116 @pytest.mark.asyncio
117 async def test_captures_last_response(self):

Callers

nothing calls this directly

Calls 3

run_agent_loopFunction · 0.90
_make_contextFunction · 0.70
_make_uiFunction · 0.70

Tested by

no test coverage detected