π OpenHands: AI-Driven Development
Fix test_ipython (#1750)
Boxuan Lieba5ef8e67be
diff --git a/tests/integration/mock/CodeActAgent/test_ipython/prompt_002.log b/tests/integration/mock/CodeActAgent/test_ipython/prompt_002.logindex b65b3fd87a..b51fe3b8c1 100644--- a/tests/integration/mock/CodeActAgent/test_ipython/prompt_002.log+++ b/tests/integration/mock/CodeActAgent/test_ipython/prompt_002.log@@ -220,10 +220,9 @@ Use Jupyter IPython to write a text file containing 'hello world' to '/workspace-----------Alright, I will write 'hello world' to the file `/workspace/test.txt` using Jupyter IPython.+Sure, I'll write "hello world" to the file `/workspace/test.txt` using Jupyter IPython. Let's proceed with that.<execute_ipython>-# Writing 'hello world' to the specified filewith open('/workspace/test.txt', 'w') as file:file.write('hello world')</execute_ipython>@@ -232,3 +231,5 @@ with open('/workspace/test.txt', 'w') as file:OBSERVATION:[Code executed successfully with no output]++ENVIRONMENT REMINDER: You have 9 turns left to complete the task.diff --git a/tests/integration/mock/CodeActAgent/test_ipython/response_001.log b/tests/integration/mock/CodeActAgent/test_ipython/response_001.logindex 1a4061908e..a292625f56 100644--- a/tests/integration/mock/CodeActAgent/test_ipython/response_001.log+++ b/tests/integration/mock/CodeActAgent/test_ipython/response_001.log@@ -1,6 +1,5 @@-Alright, I will write 'hello world' to the file `/workspace/test.txt` using Jupyter IPython.+Sure, I'll write "hello world" to the file `/workspace/test.txt` using Jupyter IPython. Let's proceed with that.<execute_ipython>-# Writing 'hello world' to the specified filewith open('/workspace/test.txt', 'w') as file:file.write('hello world')diff --git a/tests/integration/mock/CodeActAgent/test_ipython/response_002.log b/tests/integration/mock/CodeActAgent/test_ipython/response_002.logindex f31c84eaa2..da6bdd511e 100644--- a/tests/integration/mock/CodeActAgent/test_ipython/response_002.log+++ b/tests/integration/mock/CodeActAgent/test_ipython/response_002.log@@ -1 +1 @@-The text 'hello world' has been successfully written to `/workspace/test.txt`. If you need anything else, feel free to ask!+The text "hello world" has been successfully written to the file `/workspace/test.txt`. If you need any further modifications or another task, feel free to let me know!diff --git a/tests/integration/regenerate.sh b/tests/integration/regenerate.shindex 49425be08b..b8352cbaba 100755--- a/tests/integration/regenerate.sh+++ b/tests/integration/regenerate.sh@@ -32,12 +32,6 @@ for ((i = 0; i < num_of_tests; i++)); dofor ((j = 0; j < num_of_agents; j++)); doagent=${agents[j]}remind_iterations=${remind_iterations_config[j]}-- if [ "$test_name" = "test_ipython" ]; then- if [ "$agent" != "CodeActAgent" ]; then- continue- fi- fiecho -e "\n\n\n\n========Running $test_name for $agent========\n\n\n\n"rm -rf $WORKSPACE_BASE@@ -49,6 +43,7 @@ for ((i = 0; i < num_of_tests; i++)); do# Temporarily disable 'exit on error'set +efi+SANDBOX_TYPE=$SANDBOX_TYPE WORKSPACE_BASE=$WORKSPACE_BASE \MAX_ITERATIONS=$MAX_ITERATIONS REMIND_ITERATIONS=$remind_iterations \WORKSPACE_MOUNT_PATH=$WORKSPACE_MOUNT_PATH AGENT=$agent \diff --git a/tests/integration/test_agent.py b/tests/integration/test_agent.pyindex 5c5ce1bcf7..7f97d2b1ed 100644--- a/tests/integration/test_agent.py+++ b/tests/integration/test_agent.py@@ -81,8 +81,7 @@ Enjoy!def test_ipython():# Execute the tasktask = "Use Jupyter IPython to write a text file containing 'hello world' to '/workspace/test.txt'. Do not ask me for confirmation at any point."- controller = asyncio.run(main(task))- asyncio.run(controller.close())+ asyncio.run(main(task))# Verify the file existsfile_path = os.path.join(workspace_base, 'test.txt')