From: Nikolas Hermanns Date: Mon, 3 Apr 2017 14:03:08 +0000 (+0200) Subject: Do not stop tests if exception in testcase X-Git-Tag: opnfv-5.0.RC1~47 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=fbe69370c477a7b01032df701fe96ea90ec60341;p=sdnvpn.git Do not stop tests if exception in testcase Change-Id: I9e3db350be4b1ca60d6feaf2961034b50b50deb5 Signed-off-by: Nikolas Hermanns --- diff --git a/sdnvpn/test/functest/run_tests.py b/sdnvpn/test/functest/run_tests.py index 140aee2..39daf8c 100644 --- a/sdnvpn/test/functest/run_tests.py +++ b/sdnvpn/test/functest/run_tests.py @@ -13,6 +13,7 @@ import importlib import os import sys import time +import traceback import yaml import functest.utils.functest_logger as ft_logger @@ -68,11 +69,17 @@ def main(report=False): logger.info("%s\n" % ("=" * len(title))) t = importlib.import_module(testcase, package=None) start_time = time.time() - result = t.main() + try: + result = t.main() + except Exception as ex: + result = -1 + logger.info("Caught Exception in %s: %s Trace: %s" % + (test_name, ex, traceback.format_exc())) end_time = time.time() if result < 0: status = "FAIL" overall_status = "FAIL" + logger.info("Testcase %s failed" % test_name) else: status = result.get("status") details = result.get("details")