Return exit code 1 if any test failed

This commit is contained in:
shortcutme 2019-12-17 14:10:42 +01:00
parent 1e175bc41f
commit 1be56b5a39
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -4,6 +4,7 @@ import io
import math import math
import hashlib import hashlib
import re import re
import sys
from Config import config from Config import config
from Crypt import CryptHash from Crypt import CryptHash
@ -188,15 +189,21 @@ class ActionsPlugin:
if not res: if not res:
yield "! No tests found" yield "! No tests found"
sys.exit(1)
else: else:
num_failed = len([res_key for res_key, res_val in res.items() if res_val != "ok"])
num_success = len([res_key for res_key, res_val in res.items() if res_val != "ok"])
yield "* Result:\n" yield "* Result:\n"
yield " - Total: %s tests\n" % len(res) yield " - Total: %s tests\n" % len(res)
yield " - Success: %s tests\n" % len([res_key for res_key, res_val in res.items() if res_val == "ok"]) yield " - Success: %s tests\n" % num_success
yield " - Failed: %s tests\n" % len([res_key for res_key, res_val in res.items() if res_val != "ok"]) yield " - Failed: %s tests\n" % num_failed
if any(multiplers): if any(multiplers):
multipler_avg = sum(multiplers) / len(multiplers) multipler_avg = sum(multiplers) / len(multiplers)
multipler_title = self.getMultiplerTitle(multipler_avg) multipler_title = self.getMultiplerTitle(multipler_avg)
yield " - Average speed factor: %.2fx (%s)" % (multipler_avg, multipler_title) yield " - Average speed factor: %.2fx (%s)" % (multipler_avg, multipler_title)
if num_failed == 0:
sys.exit(1)
def testHttps(self, num_run=1): def testHttps(self, num_run=1):
""" """