π OpenHands: AI-Driven Development
Enforce linter in tests folder (#2557)
Boxuan Li01fa52d062fb
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex 4fff2a1754..7233bdb25a 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -47,4 +47,4 @@ jobs:- name: Install pre-commitrun: pip install pre-commit==3.7.0- name: Run pre-commit hooks- run: pre-commit run --files opendevin/**/* agenthub/**/* evaluation/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml+ run: pre-commit run --files opendevin/**/* agenthub/**/* evaluation/**/* tests/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yamldiff --git a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_002.log b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_002.logindex e0847dcb82..200359faba 100644--- a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_002.log+++ b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_002.log@@ -123,4 +123,4 @@ Here is an example with chain of thought of a valid action when clicking on a bu"In order to accomplish my goal I need to click on the button with bid 12```click("12")```-"\ No newline at end of file+"diff --git a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_003.log b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_003.logindex b427c81f34..4447400030 100644--- a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_003.log+++ b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_003.log@@ -127,4 +127,4 @@ Here is an example with chain of thought of a valid action when clicking on a bu"In order to accomplish my goal I need to click on the button with bid 12```click("12")```-"\ No newline at end of file+"diff --git a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_004.log b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_004.logindex d93405a990..d742eb245d 100644--- a/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_004.log+++ b/tests/integration/mock/CodeActAgent/test_browse_internet/prompt_004.log@@ -129,4 +129,4 @@ Here is an example with chain of thought of a valid action when clicking on a bu"In order to accomplish my goal I need to click on the button with bid 12```click("12")```-"\ No newline at end of file+"diff --git a/tests/integration/mock/CodeActSWEAgent/test_edits/response_001.log b/tests/integration/mock/CodeActSWEAgent/test_edits/response_001.logindex 188cf4676d..6a273b2088 100644--- a/tests/integration/mock/CodeActSWEAgent/test_edits/response_001.log+++ b/tests/integration/mock/CodeActSWEAgent/test_edits/response_001.log@@ -2,4 +2,3 @@ Let's start by opening the `bad.txt` file to identify and fix the typos.<execute_ipython>open_file("bad.txt")-diff --git a/tests/integration/mock/CodeActSWEAgent/test_edits/response_002.log b/tests/integration/mock/CodeActSWEAgent/test_edits/response_002.logindex 06af3ddc67..85aa976fe1 100644--- a/tests/integration/mock/CodeActSWEAgent/test_edits/response_002.log+++ b/tests/integration/mock/CodeActSWEAgent/test_edits/response_002.log@@ -6,4 +6,3 @@ Let's correct the typos in the `bad.txt` file.I will make these changes now.<execute_ipython>edit_file("bad.txt", start=1, end=4, content="This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!")-diff --git a/tests/integration/mock/CodeActSWEAgent/test_write_simple_script/response_002.log b/tests/integration/mock/CodeActSWEAgent/test_write_simple_script/response_002.logindex fd90c92f97..f9ddb50098 100644--- a/tests/integration/mock/CodeActSWEAgent/test_write_simple_script/response_002.log+++ b/tests/integration/mock/CodeActSWEAgent/test_write_simple_script/response_002.log@@ -2,4 +2,3 @@ The shell script `hello.sh` has been created and made executable. Let's run it t<execute_bash>./hello.sh-diff --git a/tests/unit/test_sandbox.py b/tests/unit/test_sandbox.pyindex 0bbb6a0680..81a27042de 100644--- a/tests/unit/test_sandbox.py+++ b/tests/unit/test_sandbox.py@@ -294,40 +294,27 @@ def test_sandbox_jupyter_plugin(temp_dir):)box.close()+def _test_sandbox_jupyter_agentskills_fileop_pwd_impl(box):box.init_plugins([AgentSkillsRequirement, JupyterRequirement])exit_code, output = box.execute('mkdir test')print(output)- assert exit_code == 0, (- 'The exit code should be 0 for ' + box.__class__.__name__- )+ assert exit_code == 0, 'The exit code should be 0 for ' + box.__class__.__name__- exit_code, output = box.execute(- 'echo "create_file(\'a.txt\')" | execute_cli'- )+ exit_code, output = box.execute('echo "create_file(\'a.txt\')" | execute_cli')print(output)- assert exit_code == 0, (- 'The exit code should be 0 for ' + box.__class__.__name__- )+ assert exit_code == 0, 'The exit code should be 0 for ' + box.__class__.__name__assert output.strip().split('\r\n') == (- '[File: /workspace/a.txt (1 lines total)]\r\n'- '1|\r\n'- '[File a.txt created.]'+ '[File: /workspace/a.txt (1 lines total)]\r\n' '1|\r\n' '[File a.txt created.]').strip().split('\r\n')exit_code, output = box.execute('cd test')print(output)- assert exit_code == 0, (- 'The exit code should be 0 for ' + box.__class__.__name__- )+ assert exit_code == 0, 'The exit code should be 0 for ' + box.__class__.__name__- exit_code, output = box.execute(- 'echo "create_file(\'a.txt\')" | execute_cli'- )+ exit_code, output = box.execute('echo "create_file(\'a.txt\')" | execute_cli')print(output)- assert exit_code == 0, (- 'The exit code should be 0 for ' + box.__class__.__name__- )+ assert exit_code == 0, 'The exit code should be 0 for ' + box.__class__.__name__assert output.strip().split('\r\n') == ('[File: /workspace/test/a.txt (1 lines total)]\r\n''1|\r\n'@@ -335,9 +322,7 @@ def _test_sandbox_jupyter_agentskills_fileop_pwd_impl(box):).strip().split('\r\n')exit_code, output = box.execute('rm -rf /workspace/*')- assert exit_code == 0, (- 'The exit code should be 0 for ' + box.__class__.__name__- )+ assert exit_code == 0, 'The exit code should be 0 for ' + box.__class__.__name__box.close()@@ -352,18 +337,17 @@ def test_sandbox_jupyter_agentskills_fileop_pwd(temp_dir):_test_sandbox_jupyter_agentskills_fileop_pwd_impl(box)[email protected](os.getenv('TEST_IN_CI') != 'true',+ os.getenv('TEST_IN_CI') != 'true',reason='The unittest need to download image, so only run on CI',)def test_agnostic_sandbox_jupyter_agentskills_fileop_pwd(temp_dir):for base_sandbox_image in ['ubuntu:22.04', 'debian:11']:# get a temporary directorywith patch.object(config, 'workspace_base', new=temp_dir), patch.object(- config, 'workspace_mount_path', new=temp_dir+ config, 'workspace_mount_path', new=temp_dir), patch.object(config, 'run_as_devin', new='true'), patch.object(config, 'sandbox_type', new='ssh'- ), patch.object(- config, 'sandbox_container_image', new=base_sandbox_image- ):+ ), patch.object(config, 'sandbox_container_image', new=base_sandbox_image):for box in [DockerSSHBox()]:- _test_sandbox_jupyter_agentskills_fileop_pwd_impl(box)\ No newline at end of file+ _test_sandbox_jupyter_agentskills_fileop_pwd_impl(box)