coverage.py: error out if tests are missing from ./tests or from coverage.txt

This commit is contained in:
Johannes Schauer Marin Rodrigues 2022-12-22 10:10:19 +01:00
parent 67fbe118f3
commit 348c582866
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -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