From 1b2479762c8784d37bbe18efe945ba44e5b3d105 Mon Sep 17 00:00:00 2001 From: Lucas Meneghel Rodrigues Date: Thu, 24 Apr 2014 11:39:02 -0300 Subject: [PATCH] avocado.test: Save log contents in Test.text_output At the end of a test, in order to make xunit information richer, we can simply save the log contents of a test in Test.text_output. It can then be recorded in the xunit file conveniently. Signed-off-by: Lucas Meneghel Rodrigues --- avocado/test.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/avocado/test.py b/avocado/test.py index 43e6d9ef..8cd4f12d 100644 --- a/avocado/test.py +++ b/avocado/test.py @@ -102,6 +102,7 @@ class Test(unittest.TestCase): self.fail_reason = None self.fail_class = None self.traceback = None + self.text_output = None self.time_elapsed = None unittest.TestCase.__init__(self) @@ -225,6 +226,8 @@ class Test(unittest.TestCase): end_time = time.time() self.time_elapsed = end_time - start_time self.report() + with open(self.logfile, 'r') as log_file_obj: + self.text_output = log_file_obj.read() self.stop_logging() def report(self): -- GitLab