From 4a233609921f338310be84f1a2bf5ba403bea745 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Fri, 13 Feb 2015 11:32:59 -0600 Subject: [PATCH] Include test failures in ctx.summary['failure_reason'] I also added a new line to make reading the log nicer Signed-off-by: Andrew Schoen --- teuthology/task/tests/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/teuthology/task/tests/__init__.py b/teuthology/task/tests/__init__.py index 7b879aabcf..8769710b10 100644 --- a/teuthology/task/tests/__init__.py +++ b/teuthology/task/tests/__init__.py @@ -32,6 +32,7 @@ class TeuthologyContextPlugin(object): def __init__(self, ctx, config): self.ctx = ctx self.config = config + self.failures = list() # this is pytest hook for generating tests with custom parameters def pytest_generate_tests(self, metafunc): @@ -69,10 +70,16 @@ class TeuthologyContextPlugin(object): )) else: # TODO: figure out a way to log the traceback - log.error("{name} Failed: {info}".format( + log.error("{name} Failed:\n {info}".format( name=name, info=call.excinfo.exconly() )) + failure = "{name}: {err}".format( + name=name, + err=call.excinfo.exconly().replace("\n", "") + ) + self.failures.append(failure) + self.ctx.summary['failure_reason'] = self.failures return report -- 2.39.5