coverage.py: actually count number of successes to print the correct number when ctrl+c was pressed

This commit is contained in:
Johannes Schauer Marin Rodrigues 2022-05-29 09:43:41 +02:00
parent 5ea760920d
commit 7198ad50f6
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -175,6 +175,7 @@ def main():
starttime = time.time() starttime = time.time()
skipped = defaultdict(list) skipped = defaultdict(list)
failed = [] failed = []
num_success = 0
for i, (test, name, dist, mode, variant, fmt) in enumerate(tests): for i, (test, name, dist, mode, variant, fmt) in enumerate(tests):
print(separator, file=sys.stderr) print(separator, file=sys.stderr)
print("(%d/%d) %s" % (i + 1, len(tests), name), file=sys.stderr) print("(%d/%d) %s" % (i + 1, len(tests), name), file=sys.stderr)
@ -228,10 +229,11 @@ def main():
print("result: FAILURE", file=sys.stderr) print("result: FAILURE", file=sys.stderr)
else: else:
print("result: SUCCESS", file=sys.stderr) print("result: SUCCESS", file=sys.stderr)
num_success += 1
if args.maxfail and len(failed) >= args.maxfail: if args.maxfail and len(failed) >= args.maxfail:
break break
print( print(
"successfully ran %d tests" % (len(tests) - len(skipped) - len(failed)), "successfully ran %d tests" % num_success,
file=sys.stderr, file=sys.stderr,
) )
if skipped: if skipped: