test_devservices_healthcheck.py 428 B

12345678910111213141516171819202122
  1. import time
  2. from unittest import mock
  3. import pytest
  4. from tools.devservices_healthcheck import run_cmd
  5. @pytest.fixture(autouse=True)
  6. def no_sleep():
  7. with mock.patch.object(time, "sleep"):
  8. yield
  9. def test_cmd_run_fail():
  10. with pytest.raises(SystemExit) as exinfo:
  11. run_cmd(["ls", "/tmp/there-is-nothing-here"], retries=1)
  12. assert exinfo.value.code != 0
  13. def test_cmd_run_ok():
  14. run_cmd(["date"])