Debian Codegraph @

scripts/ci/run-integ-tests

raw
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
6 import os
7 from contextlib import contextmanager
8 from subprocess import check_call
9
10 _dname = os.path.dirname
11
12 REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
13
14
15 @contextmanager
16 def cd(path):
17 """Change directory while inside context manager."""
18 cwd = os.getcwd()
19 try:
20 os.chdir(path)
21 yield
22 finally:
23 os.chdir(cwd)
24
25
26 def run(command, env=None):
27 return check_call(command, shell=True, env=env)
28
29
30 if __name__ == "__main__":
31 with cd(os.path.join(REPO_ROOT, "tests")):
32 run(f"{REPO_ROOT}/scripts/ci/run-tests --with-cov integration")