[PATCH 2/5] print result summary after a test has finished

Kamil Páral kparal at redhat.com
Fri Sep 10 13:52:28 UTC 2010


This patch will make every test print a short result summary after the
execution is completed. This helps very much when developing and running
tests using --local option. Otherwise there is no way how to determine
the final self.result value and other important variables (it used to be
just sent out in email). Also this printout is stored in autotest logs,
so it can be used for test review even when the corresponding email is
not accessible.
---
 lib/python/test.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/lib/python/test.py b/lib/python/test.py
index d10789d..d9a81fa 100644
--- a/lib/python/test.py
+++ b/lib/python/test.py
@@ -70,7 +70,7 @@ class AutoQATest(test.test, object):
             self.summary = ""
         self.summary = "%s: %s; %s" % (self.__class__.__name__, self.result, self.summary)
 
-        # send mail
+        # prepare email
         send_to = []
         result_email = self.config.get('test','result_email')
         if result_email and isinstance(result_email, str):
@@ -82,6 +82,16 @@ class AutoQATest(test.test, object):
             except:
                 pass
 
+        # print results to the screen
+        print '*'*40
+        print '* RESULT: %s' % self.result
+        print '* SUMMARY: %s' % self.summary
+        print '* HIGHLIGHTS: %d lines' % len(self.highlights.splitlines() if self.highlights else '')
+        print '* OUTPUTS: %d lines' % len(self.outputs.splitlines() if self.outputs else '')
+        print '* EMAIL RECIPIENTS: %s' % ', '.join(send_to)
+        print '*'*40
+
+        # send email
         if send_to:
             mail_body = "Stored logs available at <%s>\n\n" % self.autotest_url 
             mail_body += "%s\n" % self.highlights
-- 
1.7.2.2



More information about the autoqa-devel mailing list