Test monitoring background command output.
()
| 100 | |
| 101 | @pytest.mark.asyncio |
| 102 | async def test_bash_output_monitoring(): |
| 103 | """Test monitoring background command output.""" |
| 104 | print("\n=== Testing Output Monitoring ===") |
| 105 | |
| 106 | bash_tool = BashTool() |
| 107 | |
| 108 | # Start background command |
| 109 | result = await bash_tool.execute( |
| 110 | command="for i in 1 2 3 4 5; do echo 'Line '$i; sleep 0.5; done", run_in_background=True |
| 111 | ) |
| 112 | |
| 113 | assert result.success |
| 114 | bash_id = result.bash_id |
| 115 | print(f"Started background command: {bash_id}") |
| 116 | |
| 117 | bash_output_tool = BashOutputTool() |
| 118 | |
| 119 | # Check output multiple times (incremental output) |
| 120 | for i in range(3): |
| 121 | await asyncio.sleep(1) |
| 122 | output_result = await bash_output_tool.execute(bash_id=bash_id) |
| 123 | assert output_result.success |
| 124 | print(f"\n--- Check #{i + 1} ---") |
| 125 | print(f"Output:\n{output_result.content}") |
| 126 | |
| 127 | # Clean up |
| 128 | bash_kill_tool = BashKillTool() |
| 129 | await bash_kill_tool.execute(bash_id=bash_id) |
| 130 | |
| 131 | |
| 132 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected