On fail or exception exit with non-zero code.

Also, on exceptions print the exception stacktrace.
This commit is contained in:
kenkeiras 2017-05-23 23:34:33 +02:00
parent 0b52ade6b5
commit 22534160c9

View File

@ -1,3 +1,4 @@
import traceback
import logging
from .tests import basic
from .tests import gac_100
@ -10,15 +11,22 @@ tests = (
)
def main():
failed = False
for test_name, test_module in tests:
try:
test_module.main()
print(" \x1b[1;32m✓\x1b[0m {}".format(test_name))
except AssertionError as ae:
print(" \x1b[1;31m✗\x1b[0m {}: {}".format(test_name, ae.args[0]))
failed = True
except Exception as e:
print(" \x1b[1;7;31m!\x1b[0m {} {}".format(test_name, e))
raise
failed = True
traceback.print_exc()
if failed:
exit(1)
if __name__ == '__main__':
main()