Fix test_ipython (#1750)

This commit is contained in:
Boxuan Li
2024-05-12 16:15:32 -07:00
committed by GitHub
parent 4db4a84e2e
commit eba5ef8e67
5 changed files with 7 additions and 13 deletions

View File

@@ -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.

View File

@@ -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')

View File

@@ -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!

View File

@@ -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 \

View File

@@ -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')