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

Function test_background_command

tests/test_bash_tool.py:68–98  ·  view source on GitHub ↗

Test running a command in the background.

()

Source from the content-addressed store, hash-verified

66
67@pytest.mark.asyncio
68async def test_background_command():
69 """Test running a command in the background."""
70 print("\n=== Testing Background Command ===")
71
72 bash_tool = BashTool()
73 result = await bash_tool.execute(
74 command="for i in 1 2 3; do echo 'Line '$i; sleep 0.5; done", run_in_background=True
75 )
76
77 assert result.success
78 assert result.bash_id is not None
79 assert "Background command started" in result.stdout
80
81 bash_id = result.bash_id
82 print(f"Background command started with ID: {bash_id}")
83
84 # Wait a bit for output
85 await asyncio.sleep(1)
86
87 # Check output
88 bash_output_tool = BashOutputTool()
89 output_result = await bash_output_tool.execute(bash_id=bash_id)
90
91 assert output_result.success
92 print(f"Output:\n{output_result.content}")
93
94 # Clean up - terminate the background process
95 bash_kill_tool = BashKillTool()
96 kill_result = await bash_kill_tool.execute(bash_id=bash_id)
97 assert kill_result.success
98 print("Background process terminated")
99
100
101@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 6

executeMethod · 0.95
executeMethod · 0.95
executeMethod · 0.95
BashToolClass · 0.90
BashOutputToolClass · 0.90
BashKillToolClass · 0.90

Tested by

no test coverage detected