Files
OpenHands/tests/integration/test_agent.py
Robert Brennan fadcdc117e Migrate to new folder structure in preparation for refactor (#1531)
* fix up folder structure

* update docs

* fix imports

* fix imports

* fix imoprt

* fix imports

* fix imports

* fix imports

* fix test import

* fix tests

* fix main import
2024-05-02 17:01:54 +00:00

31 lines
888 B
Python

import asyncio
import os
import subprocess
import pytest
from opendevin.core.main import main
# skip if
@pytest.mark.skipif(
os.getenv('AGENT') == 'CodeActAgent'
and os.getenv('SANDBOX_TYPE').lower() == 'exec',
reason='CodeActAgent does not support exec sandbox since exec sandbox is NOT stateful',
)
def test_write_simple_script():
task = "Write a shell script 'hello.sh' that prints 'hello'."
asyncio.run(main(task))
# Verify the script file exists
script_path = 'workspace/hello.sh'
assert os.path.exists(script_path), 'The file "hello.sh" does not exist'
# Run the script and capture the output
result = subprocess.run(['bash', script_path], capture_output=True, text=True)
# Verify the output from the script
assert (
result.stdout.strip() == 'hello'
), f'Expected output "hello", but got "{result.stdout.strip()}"'