@@ -522,23 +522,24 @@ def main():
522
522
test_list += BASE_SCRIPTS
523
523
524
524
# Remove the test cases that the user has explicitly asked to exclude.
525
+ # The user can specify a test case with or without the .py extension.
525
526
if args .exclude :
526
527
def print_warning_missing_test (test_name ):
527
528
print ("{}WARNING!{} Test '{}' not found in current test list." .format (BOLD [1 ], BOLD [0 ], test_name ))
529
+ def remove_tests (exclude_list ):
530
+ if not exclude_list :
531
+ print_warning_missing_test (exclude_test )
532
+ for exclude_item in exclude_list :
533
+ test_list .remove (exclude_item )
534
+
528
535
exclude_tests = [test .strip () for test in args .exclude .split ("," )]
529
536
for exclude_test in exclude_tests :
530
- if exclude_test .endswith ('.py' ):
531
- # Remove <test_name>.py and <test_name>.py --arg from the test list
532
- exclude_list = [test for test in test_list if test .split ('.py' )[0 ] == exclude_test .split ('.py' )[0 ]]
533
- if not exclude_list :
534
- print_warning_missing_test (exclude_test )
535
- for exclude_item in exclude_list :
536
- test_list .remove (exclude_item )
537
+ # A space in the name indicates it has arguments such as "wallet_basic.py --descriptors"
538
+ if ' ' in exclude_test :
539
+ remove_tests ([test for test in test_list if test .replace ('.py' , '' ) == exclude_test .replace ('.py' , '' )])
537
540
else :
538
- try :
539
- test_list .remove (exclude_test )
540
- except ValueError :
541
- print_warning_missing_test (exclude_test )
541
+ # Exclude all variants of a test
542
+ remove_tests ([test for test in test_list if test .split ('.py' )[0 ] == exclude_test .split ('.py' )[0 ]])
542
543
543
544
if args .filter :
544
545
test_list = list (filter (re .compile (args .filter ).search , test_list ))
0 commit comments