test_hello_world.py 652 B

1234567891011121314151617181920
  1. import os
  2. import pytest
  3. from conftest import agents
  4. @pytest.mark.parametrize('agent', agents())
  5. def test_hello_world(task_file, run_test_case, agent):
  6. """Test case for the "Hello, World!" Bash script using different agents."""
  7. # Run the test case for the specified agent
  8. workspace_dir = run_test_case(agent, 'hello-world')
  9. # Validate the generated workspace
  10. assert os.path.exists(workspace_dir)
  11. assert os.path.isfile(os.path.join(workspace_dir, 'hello_world.sh'))
  12. # Execute the hello_world.sh script
  13. os.chdir(workspace_dir)
  14. output = os.popen('bash hello_world.sh').read()
  15. assert output == 'Hello, World!\n'