Skip to content

πŸ™Œ OpenHands: AI-Driven Development

(enh) add test_python_version to test_bash.py runtime tests (#4098)

tobitege575a829d94b7
diff --git a/tests/runtime/test_bash.py b/tests/runtime/test_bash.py
index 69ddfe8eca..c28957888d 100644
--- a/tests/runtime/test_bash.py
+++ b/tests/runtime/test_bash.py
@@ -456,3 +456,17 @@ def test_git_operation(box_class):
assert obs.exit_code == 0
finally:
_close_test_runtime(runtime)
+
+
+def test_python_version(temp_dir, box_class, run_as_openhands):
+ runtime = _load_runtime(temp_dir, box_class, run_as_openhands)
+ try:
+ obs = runtime.run_action(CmdRunAction(command='python --version'))
+
+ assert isinstance(
+ obs, CmdOutputObservation
+ ), 'The observation should be a CmdOutputObservation.'
+ assert obs.exit_code == 0, 'The exit code should be 0.'
+ assert 'Python 3' in obs.content, 'The output should contain "Python 3".'
+ finally:
+ _close_test_runtime(runtime)