FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Rework test runners to centralized workflow (#6400) · lovejavaee/aws-cli@ff42e29 · GitHub

forked from aws/aws-cli

Commit ff42e29

Browse files
authored
Rework test runners to centralized workflow (aws#6400)
1 parent d06494e commit ff42e29

3 files changed

Lines changed: 46 additions & 9 deletions

File tree

‎.github/workflows/run-tests.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Run tests
32

43
on:
@@ -28,10 +27,9 @@ jobs:
2827
python scripts/ci/install
2928
python scripts/ci/install-check
3029
- name: Run tests
31-
run: python scripts/ci/run-tests
30+
run: python scripts/ci/run-tests --with-cov
3231
- name: Run checks
3332
run: python scripts/ci/run-check
34-
3533
- name: codecov
3634
run: |
3735
rm tests/coverage.xml

‎scripts/ci/run-integ-tests‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ from subprocess import check_call
99
_dname = os.path.dirname
1010

1111
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"))
1313

1414

1515
def run(command):
1616
return check_call(command, shell=True)
1717

1818

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")

‎scripts/ci/run-tests‎

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,58 @@
33
# We want to ensure we're importing from the installed
44
# binary package not from the CWD.
55

6+
import argparse
67
import os
78
from subprocess import check_call
89

910
_dname = os.path.dirname
1011

1112
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"))
1315

1416

1517
def run(command):
1618
return check_call(command, shell=True)
1719

1820

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)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL