]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Include test failures in ctx.summary['failure_reason']
authorAndrew Schoen <aschoen@redhat.com>
Fri, 13 Feb 2015 17:32:59 +0000 (11:32 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Fri, 13 Feb 2015 21:07:26 +0000 (15:07 -0600)
I also added a new line to make reading the log nicer

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
teuthology/task/tests/__init__.py

index 7b879aabcff9a3e3decbae126043de326132f6e9..8769710b105e5af725c904dfc7c4d786434976c7 100644 (file)
@@ -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