python-boto3/scripts/ci/run-integ-tests

33 lines
729 B
Plaintext
Raw Normal View History

2015-11-27 23:25:33 +01:00
#!/usr/bin/env python
# Don't run tests from the root repo dir.
# We want to ensure we're importing from the installed
# binary package not from the CWD.
import os
2021-09-22 18:34:33 +02:00
from contextlib import contextmanager
2015-11-27 23:25:33 +01:00
from subprocess import check_call
_dname = os.path.dirname
REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
2021-09-22 18:34:33 +02:00
@contextmanager
def cd(path):
"""Change directory while inside context manager."""
cwd = os.getcwd()
try:
os.chdir(path)
yield
finally:
os.chdir(cwd)
2015-11-27 23:25:33 +01:00
def run(command):
return check_call(command, shell=True)
2021-09-22 18:34:33 +02:00
if __name__ == "__main__":
with cd(os.path.join(REPO_ROOT, "tests")):
run(f"{REPO_ROOT}/scripts/ci/run-tests --with-cov integration")