You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_compile_file.py 729B

12345678910111213141516171819202122
  1. import subprocess
  2. import pytest
  3. import time
  4. from dds_ci.testing import Project
  5. def test_simple_compile_file(tmp_project: Project) -> None:
  6. """
  7. Check that changing a source file will update the resulting application.
  8. """
  9. with pytest.raises(subprocess.CalledProcessError):
  10. tmp_project.compile_file('src/answer.cpp')
  11. tmp_project.write('src/answer.cpp', 'int get_answer() { return 42; }')
  12. # No error:
  13. tmp_project.compile_file('src/answer.cpp')
  14. # Fail:
  15. time.sleep(0.5)
  16. tmp_project.write('src/answer.cpp', 'int get_answer() { return "How many roads must a man walk down?"; }')
  17. with pytest.raises(subprocess.CalledProcessError):
  18. tmp_project.compile_file('src/answer.cpp')