Skip to content

Make integration tests #290

@simonrosenberg

Description

@simonrosenberg

The purpose of this issue is to add tests in tests/integration/tests/*
The tests should inherit from BaseIntegrationTest (tests/integration/base.py) the same way that TypoFixTest does (/tests/integration/tests/t01_fix_simple_typo.py)
Here is a description of the tests to write:

  1. t02_add_bash_hello.py INSTRUCTION = "Write a shell script '/workspace/hello.sh' that prints 'hello'." Setup: mkdr -p /workspace
  2. t03_jupyter_write_file.py INSTRUCTION = "Use Jupyter IPython to write a text file containing 'hello world' to '/workspace/test.txt'." Setup: mkdr -p /workspace
  3. t04_git_staging.py INSTRUCTION = 'Write a git commit message for the current staging area and commit the changes.' Setup: 'git init' + 'echo 'print("hello world")' > hello.py' " 'git add hello.py' and verify results: 'git status'
  4. 't05_simple_browsing.py` INSTRUCTION = 'Browse localhost:8000, and tell me the ultimate answer to life.' / HTML_FILE defined below. Setup: write HTML_FILE to tempfile.TemporaryDirectory + 'nohup python3 -m http.sever 8000 &'
  5. 't06_github_pr_browsing.py' INSTRUCTION = 'Look at Add MIT LICENSE OpenHands#8, and tell me what is happening there and what did @asadm suggest.'
  6. 't07_interactive_commands.py` INSTRUCTION = 'Execute the python script /workspace/python_script.py with input "John" and "25" and tell me the secret number.' Setup: SECRET_NUMBER = int(hashlib.sha256(str(25).encode()).hexdigest()[:8], 16) % 1000 / path='/workspace/python_script.py',
    content=(
    'name = input("Enter your name: "); age = input("Enter your age: "); '
    'import hashlib; secret = int(hashlib.sha256(str(age).encode()).hexdigest()[:8], 16) % 1000; '
    'print(f"Hello {name}, you are {age} years old. Tell you a secret number: {secret}")'
    )

If you need to fetch data from the web you can use custom mcp tools such as examples/07_mcp_integration.py

HTML_FILE = """

<title>The Ultimate Answer</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background: linear-gradient(to right, #1e3c72, #2a5298); color: #fff; font-family: 'Arial', sans-serif; text-align: center; } .container { text-align: center; padding: 20px; background: rgba(255, 255, 255, 0.1); border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); } h1 { font-size: 36px; margin-bottom: 20px; } p { font-size: 18px; margin-bottom: 30px; } #showButton { padding: 10px 20px; font-size: 16px; color: #1e3c72; background: #fff; border: none; border-radius: 5px; cursor: pointer; transition: background 0.3s ease; } #showButton:hover { background: #f0f0f0; } #result { margin-top: 20px; font-size: 24px; } </style>

The Ultimate Answer

Click the button to reveal the answer to life, the universe, and everything.

Click me
<script> document.getElementById('showButton').addEventListener('click', function() { document.getElementById('result').innerText = 'The answer is OpenHands is all you need!'; }); </script> """

Metadata

Metadata

Labels

openhandsSolving the issue with OpenHands.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions