| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - | ||
| 2 | 1 | name: Run tests | |
| 3 | 2 | ||
| 4 | 3 | on: | |
@@ -28,10 +27,9 @@ jobs: | |||
| 28 | 27 | python scripts/ci/install | |
| 29 | 28 | python scripts/ci/install-check | |
| 30 | 29 | - name: Run tests | |
| 31 | - run: python scripts/ci/run-tests | ||
| 30 | + run: python scripts/ci/run-tests --with-cov | ||
| 32 | 31 | - name: Run checks | |
| 33 | 32 | run: python scripts/ci/run-check | |
| 34 | - | ||
| 35 | 33 | - name: codecov | |
| 36 | 34 | run: | | |
| 37 | 35 | rm tests/coverage.xml | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,12 +9,11 @@ from subprocess import check_call | |||
| 9 | 9 | _dname = os.path.dirname | |
| 10 | 10 | ||
| 11 | 11 | REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__)))) | |
| 12 | - os.chdir(os.path.join(REPO_ROOT, 'tests')) | ||
| 12 | + os.chdir(os.path.join(REPO_ROOT, "tests")) | ||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 15 | def run(command): | |
| 16 | 16 | return check_call(command, shell=True) | |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | - run('nosetests --with-xunit --cover-erase --with-coverage ' | ||
| 20 | - '--cover-package awscli --cover-xml -v integration') | ||
| 19 | + run(f"{REPO_ROOT}/scripts/ci/run-tests --with-cov integration") | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,18 +3,58 @@ | |||
| 3 | 3 | # We want to ensure we're importing from the installed | |
| 4 | 4 | # binary package not from the CWD. | |
| 5 | 5 | ||
| 6 | + import argparse | ||
| 6 | 7 | import os | |
| 7 | 8 | from subprocess import check_call | |
| 8 | 9 | ||
| 9 | 10 | _dname = os.path.dirname | |
| 10 | 11 | ||
| 11 | 12 | REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__)))) | |
| 12 | - os.chdir(os.path.join(REPO_ROOT, 'tests')) | ||
| 13 | + PACKAGE = "awscli" | ||
| 14 | + os.chdir(os.path.join(REPO_ROOT, "tests")) | ||
| 13 | 15 | ||
| 14 | 16 | ||
| 15 | 17 | def run(command): | |
| 16 | 18 | return check_call(command, shell=True) | |
| 17 | 19 | ||
| 18 | 20 | ||
| 19 | - run('nosetests --with-coverage --cover-erase --cover-package awscli ' | ||
| 20 | - '--traverse-namespace --with-xunit --cover-xml unit/ functional/') | ||
| 21 | + def process_args(args): | ||
| 22 | + runner = args.test_runner | ||
| 23 | + test_args = '' | ||
| 24 | + if args.with_cov: | ||
| 25 | + test_args += ( | ||
| 26 | + f"--with-xunit --cover-erase --with-coverage " | ||
| 27 | + f"--cover-package {PACKAGE} --cover-xml -v " | ||
| 28 | + ) | ||
| 29 | + dirs = " ".join(args.test_dirs) | ||
| 30 | + | ||
| 31 | + return runner, test_args, dirs | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + if __name__ == "__main__": | ||
| 35 | + parser = argparse.ArgumentParser() | ||
| 36 | + parser.add_argument( | ||
| 37 | + "test_dirs", | ||
| 38 | + default=["unit/", "functional/"], | ||
| 39 | + nargs="*", | ||
| 40 | + help="One or more directories containing tests.", | ||
| 41 | + ) | ||
| 42 | + parser.add_argument( | ||
| 43 | + "-r", | ||
| 44 | + "--test-runner", | ||
| 45 | + default="nosetests", | ||
| 46 | + help="Test runner to execute tests. Defaults to nose.", | ||
| 47 | + ) | ||
| 48 | + parser.add_argument( | ||
| 49 | + "-c", | ||
| 50 | + "--with-cov", | ||
| 51 | + default=False, | ||
| 52 | + action="store_true", | ||
| 53 | + help="Run default test-runner with code coverage enabled.", | ||
| 54 | + ) | ||
| 55 | + raw_args = parser.parse_args() | ||
| 56 | + test_runner, test_args, test_dirs = process_args(raw_args) | ||
| 57 | + | ||
| 58 | + cmd = f"{test_runner} {test_args}{test_dirs}" | ||
| 59 | + print(f"Running {cmd}...") | ||
| 60 | + run(cmd) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments