From b535c14554294ddfcc0d5e2d3fa39e898aabb1a7 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Wed, 6 Dec 2017 06:07:44 +1000 Subject: [PATCH] suggestion^2: just use an re, add LEEWAY back --- test/functional/test_runner.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 43b3bbaee9bd..af8b273d62a9 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -463,21 +463,18 @@ def check_script_prefixes(): """Check that no more than `EXPECTED_VIOLATION_COUNT` of the test scripts don't start with one of the allowed name prefixes.""" EXPECTED_VIOLATION_COUNT = 77 + LEEWAY = 10 - good_prefixes = ["feature_", "interface_", "mempool_", "mining_", "p2p_", "rpc_", "wallet_", "example_test"] - good_prefixes_re = re.compile("|".join(good_prefixes)) - + good_prefixes_re = re.compile("(feature|interface|mempool|mining|p2p|rpc|wallet|example)_") bad_script_names = [script for script in ALL_SCRIPTS if good_prefixes_re.match(script) is None] if len(bad_script_names) < EXPECTED_VIOLATION_COUNT: print("{}HURRAY!{} Number of functional tests violating naming convention reduced!".format(BOLD[1], BOLD[0])) print("Consider reducing EXPECTED_VIOLATION_COUNT from %d to %d" % (EXPECTED_VIOLATION_COUNT, len(bad_script_names))) - elif len(bad_script_names) == EXPECTED_VIOLATION_COUNT: - pass - else: + elif len(bad_script_names) > EXPECTED_VIOLATION_COUNT: print("INFO: tests not meeting naming conventions:") print(" %s" % ("\n ".join(sorted(bad_script_names)))) - raise(AssertionError("Too many tests not following naming convention! (%d found, expected: <= %d)" % (len(bad_script_names), EXPECTED_VIOLATION_COUNT))) + assert len(bad_script_names) <= EXPECTED_VIOLATION_COUNT + LEEWAY, "Too many tests not following naming convention! (%d found, expected: <= %d)" % (len(bad_script_names), EXPECTED_VIOLATION_COUNT) class RPCCoverage(object): """