diff options
author | Max Edwards <youwontforgetthis@gmail.com> | 2024-06-12 16:43:05 +0100 |
---|---|---|
committer | Max Edwards <youwontforgetthis@gmail.com> | 2024-06-12 16:50:44 +0100 |
commit | c4762b0aa06f2654d108bc7ca05887ffd88cf6f8 (patch) | |
tree | a531c918cd94a1b227dc75ed61bc1c59ad2ed141 /test/functional/test_runner.py | |
parent | aa6b876e010ef90bf15c63a8f754e91a64b230cd (diff) |
test: allow excluding func test by name and arg
Can now specify test_runner.py --exclude "rpc_bind.py --ipv6" and have only that test variant excluded
Diffstat (limited to 'test/functional/test_runner.py')
-rwxr-xr-x | test/functional/test_runner.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 84e524558f..2a4d929be1 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -510,14 +510,22 @@ def main(): # Remove the test cases that the user has explicitly asked to exclude. if args.exclude: - exclude_tests = [test.split('.py')[0] for test in args.exclude.split(',')] + def print_warning_missing_test(test_name): + print("{}WARNING!{} Test '{}' not found in current test list.".format(BOLD[1], BOLD[0], test_name)) + exclude_tests = [test.strip() for test in args.exclude.split(",")] for exclude_test in exclude_tests: - # Remove <test_name>.py and <test_name>.py --arg from the test list - exclude_list = [test for test in test_list if test.split('.py')[0] == exclude_test] - for exclude_item in exclude_list: - test_list.remove(exclude_item) - if not exclude_list: - print("{}WARNING!{} Test '{}' not found in current test list.".format(BOLD[1], BOLD[0], exclude_test)) + if exclude_test.endswith('.py'): + # Remove <test_name>.py and <test_name>.py --arg from the test list + exclude_list = [test for test in test_list if test.split('.py')[0] == exclude_test.split('.py')[0]] + if not exclude_list: + print_warning_missing_test(exclude_test) + for exclude_item in exclude_list: + test_list.remove(exclude_item) + else: + try: + test_list.remove(exclude_test) + except ValueError: + print_warning_missing_test(exclude_test) if args.filter: test_list = list(filter(re.compile(args.filter).search, test_list)) |