mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
* Add integration test framework with mock llm * Fix MonologueAgent and PlannerAgent tests * Remove adhoc logging * Use existing logs * Fix SWEAgent and PlannerAgent * Check-in test log files * conftest: look up under test name folder only * Add docstring to conftest * Finish dev doc * Avoid non-determinism * Remove dependency on llm embedding model * Init embedding model only for MonologueAgent * Add adhoc fix for sandbox discrepancy * Test ssh and exec sandboxes * CI: fix missing sandbox type * conftest: Remove hack * Reword comment for TODO
24 lines
774 B
Python
24 lines
774 B
Python
import os
|
|
import asyncio
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
from opendevin.main import main
|
|
|
|
|
|
@pytest.mark.skipif(os.environ.get('AGENT') == 'CodeActAgent', reason='CodeActAgent requires task to be in a special format')
|
|
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()}"'
|