Ver código fonte

Fix test_ipython (#1750)

Boxuan Li 1 ano atrás
pai
commit
eba5ef8e67

+ 3 - 2
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 file
 with 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.

+ 1 - 2
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 file
 with open('/workspace/test.txt', 'w') as file:
     file.write('hello world')

+ 1 - 1
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!

+ 1 - 6
tests/integration/regenerate.sh

@@ -32,12 +32,6 @@ for ((i = 0; i < num_of_tests; i++)); do
   for ((j = 0; j < num_of_agents; j++)); do
     agent=${agents[j]}
     remind_iterations=${remind_iterations_config[j]}
-    
-    if [ "$test_name" = "test_ipython" ]; then
-      if [ "$agent" != "CodeActAgent" ]; then
-        continue
-      fi
-    fi
 
     echo -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 +e
     fi
+
     SANDBOX_TYPE=$SANDBOX_TYPE WORKSPACE_BASE=$WORKSPACE_BASE \
       MAX_ITERATIONS=$MAX_ITERATIONS REMIND_ITERATIONS=$remind_iterations \
       WORKSPACE_MOUNT_PATH=$WORKSPACE_MOUNT_PATH AGENT=$agent \

+ 1 - 2
tests/integration/test_agent.py

@@ -81,8 +81,7 @@ Enjoy!
 def test_ipython():
     # Execute the task
     task = "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 exists
     file_path = os.path.join(workspace_base, 'test.txt')