run-integ-tests 748 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env python
  2. # Don't run tests from the root repo dir.
  3. # We want to ensure we're importing from the installed
  4. # binary package not from the CWD.
  5. import os
  6. from contextlib import contextmanager
  7. from subprocess import check_call
  8. _dname = os.path.dirname
  9. REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
  10. @contextmanager
  11. def cd(path):
  12. """Change directory while inside context manager."""
  13. cwd = os.getcwd()
  14. try:
  15. os.chdir(path)
  16. yield
  17. finally:
  18. os.chdir(cwd)
  19. def run(command, env=None):
  20. return check_call(command, shell=True, env=env)
  21. if __name__ == "__main__":
  22. with cd(os.path.join(REPO_ROOT, "tests")):
  23. run(f"{REPO_ROOT}/scripts/ci/run-tests --with-cov integration")