|
9 | 9 | from opendevin.runtime.docker.exec_box import DockerExecBox
|
10 | 10 | from opendevin.runtime.docker.local_box import LocalBox
|
11 | 11 | from opendevin.runtime.docker.ssh_box import DockerSSHBox, split_bash_commands
|
12 |
| -from opendevin.runtime.plugins import JupyterRequirement |
| 12 | +from opendevin.runtime.plugins import AgentSkillsRequirement, JupyterRequirement |
13 | 13 |
|
14 | 14 |
|
15 | 15 | @pytest.fixture
|
@@ -293,3 +293,51 @@ def test_sandbox_jupyter_plugin(temp_dir):
|
293 | 293 | + box.__class__.__name__
|
294 | 294 | )
|
295 | 295 | box.close()
|
| 296 | + |
| 297 | + |
| 298 | +def test_sandbox_jupyter_agentskills_fileop_pwd(temp_dir): |
| 299 | + # get a temporary directory |
| 300 | + with patch.object(config, 'workspace_base', new=temp_dir), patch.object( |
| 301 | + config, 'workspace_mount_path', new=temp_dir |
| 302 | + ), patch.object(config, 'run_as_devin', new='true'), patch.object( |
| 303 | + config, 'sandbox_type', new='ssh' |
| 304 | + ): |
| 305 | + for box in [DockerSSHBox()]: |
| 306 | + box.init_plugins([AgentSkillsRequirement, JupyterRequirement]) |
| 307 | + exit_code, output = box.execute('mkdir test') |
| 308 | + print(output) |
| 309 | + assert exit_code == 0, ( |
| 310 | + 'The exit code should be 0 for ' + box.__class__.__name__ |
| 311 | + ) |
| 312 | + |
| 313 | + exit_code, output = box.execute( |
| 314 | + 'echo "create_file(\'a.txt\')" | execute_cli' |
| 315 | + ) |
| 316 | + print(output) |
| 317 | + assert exit_code == 0, ( |
| 318 | + 'The exit code should be 0 for ' + box.__class__.__name__ |
| 319 | + ) |
| 320 | + assert output.strip().split('\r\n') == ( |
| 321 | + '[File: /workspace/a.txt (1 lines total)]\r\n' |
| 322 | + '1|\r\n' |
| 323 | + '[File a.txt created.]' |
| 324 | + ).strip().split('\r\n') |
| 325 | + |
| 326 | + exit_code, output = box.execute('cd test') |
| 327 | + print(output) |
| 328 | + assert exit_code == 0, ( |
| 329 | + 'The exit code should be 0 for ' + box.__class__.__name__ |
| 330 | + ) |
| 331 | + |
| 332 | + exit_code, output = box.execute( |
| 333 | + 'echo "create_file(\'a.txt\')" | execute_cli' |
| 334 | + ) |
| 335 | + print(output) |
| 336 | + assert exit_code == 0, ( |
| 337 | + 'The exit code should be 0 for ' + box.__class__.__name__ |
| 338 | + ) |
| 339 | + assert output.strip().split('\r\n') == ( |
| 340 | + '[File: /workspace/test/a.txt (1 lines total)]\r\n' |
| 341 | + '1|\r\n' |
| 342 | + '[File a.txt created.]' |
| 343 | + ).strip().split('\r\n') |
0 commit comments