diff options
author | Max Edwards <youwontforgetthis@gmail.com> | 2024-09-11 18:27:49 +0100 |
---|---|---|
committer | Max Edwards <youwontforgetthis@gmail.com> | 2024-09-12 13:42:34 +0100 |
commit | 72b46f28bf8d37a166961b5aa2a22302b932b756 (patch) | |
tree | 8dd25467796524a77322eb1648465958f71ad2f1 /test/functional/test_runner.py | |
parent | 0725a374941355349bb4bc8a79dad1affb27d3b9 (diff) |
test: fix exclude parsing for functional runner
This restores previous behaviour of being able to exclude a test by name without having to specify .py extension.
Diffstat (limited to 'test/functional/test_runner.py')
-rwxr-xr-x | test/functional/test_runner.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index bee9622709..aad2af69df 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -522,23 +522,24 @@ def main(): test_list += BASE_SCRIPTS # Remove the test cases that the user has explicitly asked to exclude. + # The user can specify a test case with or without the .py extension. if args.exclude: def print_warning_missing_test(test_name): print("{}WARNING!{} Test '{}' not found in current test list.".format(BOLD[1], BOLD[0], test_name)) + def remove_tests(exclude_list): + if not exclude_list: + print_warning_missing_test(exclude_test) + for exclude_item in exclude_list: + test_list.remove(exclude_item) + exclude_tests = [test.strip() for test in args.exclude.split(",")] for exclude_test in exclude_tests: - 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) + # A space in the name indicates it has arguments such as "wallet_basic.py --descriptors" + if ' ' in exclude_test: + remove_tests([test for test in test_list if test.replace('.py', '') == exclude_test.replace('.py', '')]) else: - try: - test_list.remove(exclude_test) - except ValueError: - print_warning_missing_test(exclude_test) + # Exclude all variants of a test + remove_tests([test for test in test_list if test.split('.py')[0] == exclude_test.split('.py')[0]]) if args.filter: test_list = list(filter(re.compile(args.filter).search, test_list)) |