From 348c582866c93d3b64f8cd7f0e9bdac27ef30d63 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Thu, 22 Dec 2022 10:10:19 +0100 Subject: [PATCH] coverage.py: error out if tests are missing from ./tests or from coverage.txt --- coverage.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/coverage.py b/coverage.py index a76fc76..39ba46b 100755 --- a/coverage.py +++ b/coverage.py @@ -207,13 +207,27 @@ def main(): # parse coverage.txt config_order, config_dict = parse_config("coverage.txt") - if set(os.listdir("tests")) - set(config_order): + indirbutnotcovered = set( + [d for d in os.listdir("tests") if not d.startswith(".")] + ) - set(config_order) + if indirbutnotcovered: print( "test(s) missing from coverage.txt: %s" - % (", ".join(sorted(set(os.listdir("tests")) - set(config_order)))), + % (", ".join(sorted(indirbutnotcovered))), file=sys.stderr, ) exit(1) + coveredbutnotindir = set(config_order) - set( + [d for d in os.listdir("tests") if not d.startswith(".")] + ) + if coveredbutnotindir: + print( + "test(s) missing from ./tests: %s" + % (", ".join(sorted(coveredbutnotindir))), + file=sys.stderr, + ) + + exit(1) # produce the list of tests using the cartesian product of all allowed # dists, modes, variants and formats of a given test