Skip to content

Commit

Permalink
Add ability to skip tests (#853)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardsliu authored and k8s-ci-robot committed Oct 25, 2018
1 parent f86a311 commit 5a85d7b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion py/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ def add_common_args(parser):
type=int,
help="Number of times to run this test.")

parser.add_argument(
"--skip_tests",
default=None,
type=str,
help="A comma delimited list of tests to skip.")


def main(module=None): # pylint: disable=too-many-locals
logging.getLogger().setLevel(logging.INFO) # pylint: disable=too-many-locals
Expand All @@ -180,6 +186,9 @@ def main(module=None): # pylint: disable=too-many-locals

args = parser.parse_args()
test_module = import_module(module)
skip_tests = []
if args.skip_tests:
skip_tests = args.skip_tests.split(",")

types = dir(test_module)
for t_name in types:
Expand All @@ -190,7 +199,7 @@ def main(module=None): # pylint: disable=too-many-locals
funcs = dir(test_case)

for f in funcs:
if f.startswith("test_"):
if f.startswith("test_") and not f in skip_tests:
test_func = getattr(test_case, f)
logging.info("Invoking test method: %s", test_func)
run_test(test_case, test_func, args)
Expand Down

0 comments on commit 5a85d7b

Please sign in to comment.