test_hello_world.py 659 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. """
  7. Test case for the "Hello, World!" Bash script using different agents.
  8. """
  9. # Run the test case for the specified agent
  10. workspace_dir = run_test_case(agent, 'hello-world')
  11. # Validate the generated workspace
  12. assert os.path.exists(workspace_dir)
  13. assert os.path.isfile(os.path.join(workspace_dir, 'hello_world.sh'))
  14. # Execute the hello_world.sh script
  15. os.chdir(workspace_dir)
  16. output = os.popen('bash hello_world.sh').read()
  17. assert output == 'Hello, World!\n'