MCPcopy Index your code
hub / github.com/MiniMax-AI/Mini-Agent / test_bash_kill

Function test_bash_kill

tests/test_bash_tool.py:164–194  ·  view source on GitHub ↗

Test terminating a background command.

()

Source from the content-addressed store, hash-verified

162
163@pytest.mark.asyncio
164async def test_bash_kill():
165 """Test terminating a background command."""
166 print("\n=== Testing Bash Kill ===")
167
168 bash_tool = BashTool()
169
170 # Start a long-running background command
171 result = await bash_tool.execute(command="sleep 100", run_in_background=True)
172
173 assert result.success
174 bash_id = result.bash_id
175 print(f"Started long-running command: {bash_id}")
176
177 # Verify it's running
178 await asyncio.sleep(0.5)
179 bg_shell = BackgroundShellManager.get(bash_id)
180 assert bg_shell is not None
181 assert bg_shell.status == "running"
182
183 # Kill it
184 bash_kill_tool = BashKillTool()
185 kill_result = await bash_kill_tool.execute(bash_id=bash_id)
186
187 assert kill_result.success
188 # exit_code -15 means terminated by SIGTERM
189 assert kill_result.exit_code == -15 or kill_result.bash_id == bash_id
190 print(f"Kill result:\n{kill_result.content}")
191
192 # Verify it's removed from manager
193 bg_shell = BackgroundShellManager.get(bash_id)
194 assert bg_shell is None
195
196
197@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 5

executeMethod · 0.95
executeMethod · 0.95
BashToolClass · 0.90
BashKillToolClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected