Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)_")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this is nicer. Perhaps place example at the front to maintain alphabetic sorting

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):
"""
Expand Down