diff --git a/tests/runtime/test_bash.py b/tests/runtime/test_bash.py index e64dcca10b7d..81cea6369194 100644 --- a/tests/runtime/test_bash.py +++ b/tests/runtime/test_bash.py @@ -602,31 +602,31 @@ def test_command_output_continuation(temp_dir, runtime_cls, run_as_openhands): try: # Start a command that produces output slowly action = CmdRunAction('for i in {1..5}; do echo $i; sleep 3; done') - action.timeout = 2 # Set timeout to 2 seconds + action.timeout = 2.5 # Set timeout to 2.5 seconds obs = runtime.run_action(action) assert obs.content.strip() == '1' assert obs.metadata.prefix == '' - assert '[The command timed out after 2 seconds.' in obs.metadata.suffix + assert '[The command timed out after 2.5 seconds.' in obs.metadata.suffix # Continue watching output action = CmdRunAction('') - action.timeout = 2 + action.timeout = 2.5 obs = runtime.run_action(action) assert '[Command output continued from previous command]' in obs.metadata.prefix assert obs.content.strip() == '2' - assert '[The command timed out after 2 seconds.' in obs.metadata.suffix + assert '[The command timed out after 2.5 seconds.' in obs.metadata.suffix # Continue until completion for expected in ['3', '4', '5']: action = CmdRunAction('') - action.timeout = 2 + action.timeout = 2.5 obs = runtime.run_action(action) assert ( '[Command output continued from previous command]' in obs.metadata.prefix ) assert obs.content.strip() == expected - assert '[The command timed out after 2 seconds.' in obs.metadata.suffix + assert '[The command timed out after 2.5 seconds.' in obs.metadata.suffix # Final empty command to complete action = CmdRunAction('') @@ -643,34 +643,34 @@ def test_long_running_command_follow_by_execute( try: # Test command that produces output slowly action = CmdRunAction('for i in {1..3}; do echo $i; sleep 3; done') - action.timeout = 2 + action.timeout = 2.5 action.blocking = False obs = runtime.run_action(action) assert '1' in obs.content # First number should appear before timeout assert obs.metadata.exit_code == -1 # -1 indicates command is still running - assert '[The command timed out after 2 seconds.' in obs.metadata.suffix + assert '[The command timed out after 2.5 seconds.' in obs.metadata.suffix assert obs.metadata.prefix == '' # Continue watching output action = CmdRunAction('') - action.timeout = 2 + action.timeout = 2.5 obs = runtime.run_action(action) assert '2' in obs.content assert ( obs.metadata.prefix == '[Command output continued from previous command]\n' ) - assert '[The command timed out after 2 seconds.' in obs.metadata.suffix + assert '[The command timed out after 2.5 seconds.' in obs.metadata.suffix assert obs.metadata.exit_code == -1 # -1 indicates command is still running # Test command that produces no output action = CmdRunAction('sleep 15') - action.timeout = 2 + action.timeout = 2.5 obs = runtime.run_action(action) assert '3' in obs.content assert ( obs.metadata.prefix == '[Command output continued from previous command]\n' ) - assert '[The command timed out after 2 seconds.' in obs.metadata.suffix + assert '[The command timed out after 2.5 seconds.' in obs.metadata.suffix assert obs.metadata.exit_code == -1 # -1 indicates command is still running finally: _close_test_runtime(runtime)