From 771b18dec2d3d637d1e989e4ce2cc3147ecd9c47 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Ollivier?= Date: Thu, 18 May 2017 20:19:45 +0200 Subject: [PATCH] Print stack when catching exceptions in run_tests.py MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Id94475dd519ce04b87da470f6e6bb5a1c1aa2d75 Signed-off-by: Cédric Ollivier --- functest/ci/run_tests.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py index f973b616c..95353c87a 100755 --- a/functest/ci/run_tests.py +++ b/functest/ci/run_tests.py @@ -122,10 +122,9 @@ class Runner(object): if not test.is_enabled(): raise TestNotEnabled( "The test case {} is not enabled".format(test.get_name())) - test_name = test.get_name() logger.info("\n") # blank line self.print_separator("=") - logger.info("Running test case '%s'..." % test_name) + logger.info("Running test case '%s'..." % test.get_name()) self.print_separator("=") logger.debug("\n%s" % test) self.source_rc_file() @@ -133,17 +132,17 @@ class Runner(object): if test.needs_clean() and self.clean_flag: self.generate_os_snapshot() - flags = (" -t %s" % (test_name)) + flags = " -t %s" % test.get_name() if self.report_flag: flags += " -r" result = testcase.TestCase.EX_RUN_ERROR - run_dict = self.get_run_dict(test_name) + run_dict = self.get_run_dict(test.get_name()) if run_dict: try: module = importlib.import_module(run_dict['module']) cls = getattr(module, run_dict['class']) - test_dict = ft_utils.get_dict_by_test(test_name) + test_dict = ft_utils.get_dict_by_test(test.get_name()) test_case = cls(**test_dict) self.executed_test_cases.append(test_case) try: @@ -168,7 +167,7 @@ class Runner(object): if test.needs_clean() and self.clean_flag: self.cleanup() if result != testcase.TestCase.EX_OK: - logger.error("The test case '%s' failed. " % test_name) + logger.error("The test case '%s' failed. " % test.get_name()) self.overall_result = Result.EX_ERROR if test.is_blocking(): raise BlockingTestFailed( @@ -242,8 +241,10 @@ class Runner(object): return Result.EX_ERROR else: self.run_all(_tiers) + except BlockingTestFailed: + pass except Exception: - logger.exception("Runner failed") + logger.exception("Failures when running testcase(s)") self.overall_result = Result.EX_ERROR msg = prettytable.PrettyTable( -- 2.16.6