|
|
@@ -48,9 +48,10 @@ async def test_simple_cmd_ipython_and_fileop(temp_dir, box_class, run_as_openhan
|
|
|
assert isinstance(obs, IPythonRunCellObservation)
|
|
|
|
|
|
logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
|
|
- assert (
|
|
|
- obs.content.strip()
|
|
|
- == 'Hello, `World`!\n[Jupyter current working directory: /workspace]'
|
|
|
+ assert obs.content.strip() == (
|
|
|
+ 'Hello, `World`!\n'
|
|
|
+ '[Jupyter current working directory: /workspace]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
)
|
|
|
|
|
|
# Test read file (file should not exist)
|
|
|
@@ -122,7 +123,11 @@ async def test_ipython_multi_user(temp_dir, box_class, run_as_openhands):
|
|
|
logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
|
|
assert (
|
|
|
obs.content.strip()
|
|
|
- == '/workspace\n[Jupyter current working directory: /workspace]'
|
|
|
+ == (
|
|
|
+ '/workspace\n'
|
|
|
+ '[Jupyter current working directory: /workspace]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
+ ).strip()
|
|
|
)
|
|
|
|
|
|
# write a file
|
|
|
@@ -134,7 +139,11 @@ async def test_ipython_multi_user(temp_dir, box_class, run_as_openhands):
|
|
|
assert isinstance(obs, IPythonRunCellObservation)
|
|
|
assert (
|
|
|
obs.content.strip()
|
|
|
- == '[Code executed successfully with no output]\n[Jupyter current working directory: /workspace]'
|
|
|
+ == (
|
|
|
+ '[Code executed successfully with no output]\n'
|
|
|
+ '[Jupyter current working directory: /workspace]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
+ ).strip()
|
|
|
)
|
|
|
|
|
|
# check file owner via bash
|
|
|
@@ -174,7 +183,14 @@ async def test_ipython_simple(temp_dir, box_class):
|
|
|
obs = await runtime.run_action(action_ipython)
|
|
|
assert isinstance(obs, IPythonRunCellObservation)
|
|
|
logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
|
|
- assert obs.content.strip() == '1\n[Jupyter current working directory: /workspace]'
|
|
|
+ assert (
|
|
|
+ obs.content.strip()
|
|
|
+ == (
|
|
|
+ '1\n'
|
|
|
+ '[Jupyter current working directory: /workspace]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
+ ).strip()
|
|
|
+ )
|
|
|
|
|
|
await runtime.close()
|
|
|
await asyncio.sleep(1)
|
|
|
@@ -208,7 +224,8 @@ async def _test_ipython_agentskills_fileop_pwd_impl(
|
|
|
'1|\n'
|
|
|
'(this is the end of the file)\n'
|
|
|
'[File hello.py created.]\n'
|
|
|
- '[Jupyter current working directory: /workspace]'
|
|
|
+ '[Jupyter current working directory: /workspace]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
).strip().split('\n')
|
|
|
|
|
|
action = CmdRunAction(command='cd test')
|
|
|
@@ -231,7 +248,8 @@ async def _test_ipython_agentskills_fileop_pwd_impl(
|
|
|
'1|\n'
|
|
|
'(this is the end of the file)\n'
|
|
|
'[File hello.py created.]\n'
|
|
|
- '[Jupyter current working directory: /workspace/test]'
|
|
|
+ '[Jupyter current working directory: /workspace/test]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
).strip().split('\n')
|
|
|
|
|
|
if enable_auto_lint:
|
|
|
@@ -265,6 +283,7 @@ Your changes have NOT been applied. Please fix your edit command and try again.
|
|
|
You either need to 1) Specify the correct start/end line arguments or 2) Correct your edit code.
|
|
|
DO NOT re-run the same failed edit command. Running it again will lead to the same error.
|
|
|
[Jupyter current working directory: /workspace/test]
|
|
|
+[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]
|
|
|
"""
|
|
|
).strip().split('\n')
|
|
|
|
|
|
@@ -284,6 +303,7 @@ DO NOT re-run the same failed edit command. Running it again will lead to the sa
|
|
|
(this is the end of the file)
|
|
|
[File updated (edited at line 1). Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
|
|
|
[Jupyter current working directory: /workspace/test]
|
|
|
+[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]
|
|
|
"""
|
|
|
).strip().split('\n')
|
|
|
|
|
|
@@ -350,7 +370,8 @@ async def test_ipython_agentskills_fileop_pwd_with_userdir(temp_dir, box_class):
|
|
|
'1|\n'
|
|
|
'(this is the end of the file)\n'
|
|
|
'[File hello.py created.]\n'
|
|
|
- '[Jupyter current working directory: /root]'
|
|
|
+ '[Jupyter current working directory: /root]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
).strip().split('\n')
|
|
|
|
|
|
action = CmdRunAction(command='cd test')
|
|
|
@@ -373,7 +394,8 @@ async def test_ipython_agentskills_fileop_pwd_with_userdir(temp_dir, box_class):
|
|
|
'1|\n'
|
|
|
'(this is the end of the file)\n'
|
|
|
'[File hello.py created.]\n'
|
|
|
- '[Jupyter current working directory: /root/test]'
|
|
|
+ '[Jupyter current working directory: /root/test]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
).strip().split('\n')
|
|
|
|
|
|
await runtime.close()
|
|
|
@@ -407,9 +429,10 @@ async def test_ipython_package_install(temp_dir, box_class, run_as_openhands):
|
|
|
obs = await runtime.run_action(action)
|
|
|
logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
|
|
# import should not error out
|
|
|
- assert (
|
|
|
- obs.content.strip()
|
|
|
- == '[Code executed successfully with no output]\n[Jupyter current working directory: /workspace]'
|
|
|
+ assert obs.content.strip() == (
|
|
|
+ '[Code executed successfully with no output]\n'
|
|
|
+ '[Jupyter current working directory: /workspace]\n'
|
|
|
+ '[Jupyter Python interpreter: /openhands/poetry/openhands-5O4_aCHf-py3.11/bin/python]'
|
|
|
)
|
|
|
|
|
|
await runtime.close()
|