提交 29650ee4 编写于 作者: L Lukáš Doktor

Test: Stop publishing text_output

Publishing of text_output doesn't makes much sense as what it does is
basically just open `self.logfile` and writes the content into memory.
This was only used by `xunit` plugin and this plugin can simply open the
file and read it.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 c4f810f9
...@@ -233,7 +233,6 @@ class Test(unittest.TestCase): ...@@ -233,7 +233,6 @@ class Test(unittest.TestCase):
self.log.info('START %s', self.name) self.log.info('START %s', self.name)
self.text_output = None
self.__status = None self.__status = None
self.__fail_reason = None self.__fail_reason = None
self.__fail_class = None self.__fail_class = None
...@@ -446,7 +445,7 @@ class Test(unittest.TestCase): ...@@ -446,7 +445,7 @@ class Test(unittest.TestCase):
self._update_time_elapsed() self._update_time_elapsed()
preserve_attr = ['basedir', 'debugdir', 'depsdir', 'fail_reason', preserve_attr = ['basedir', 'debugdir', 'depsdir', 'fail_reason',
'logdir', 'logfile', 'name', 'resultsdir', 'srcdir', 'logdir', 'logfile', 'name', 'resultsdir', 'srcdir',
'status', 'text_output', 'time_elapsed', 'status', 'time_elapsed',
'traceback', 'workdir', 'whiteboard', 'time_start', 'traceback', 'workdir', 'whiteboard', 'time_start',
'time_end', 'running', 'paused', 'paused_msg', 'time_end', 'running', 'paused', 'paused_msg',
'fail_class', 'params', "timeout"] 'fail_class', 'params', "timeout"]
...@@ -707,8 +706,6 @@ class Test(unittest.TestCase): ...@@ -707,8 +706,6 @@ class Test(unittest.TestCase):
self._tag_end() self._tag_end()
self._report() self._report()
self.log.info("") self.log.info("")
with open(self.logfile, 'r') as log_file_obj:
self.text_output = log_file_obj.read()
self._stop_logging() self._stop_logging()
def _report(self): def _report(self):
......
...@@ -61,7 +61,12 @@ class XUnitResult(Result): ...@@ -61,7 +61,12 @@ class XUnitResult(Result):
traceback = document.createCDATASection(traceback_content) traceback = document.createCDATASection(traceback_content)
element.appendChild(traceback) element.appendChild(traceback)
system_out = Element('system-out') system_out = Element('system-out')
system_out_cdata_content = self._escape_cdata(test.get('text_output', self.UNKNOWN)) try:
with open(test.get("logfile"), "r") as logfile_obj:
text_output = logfile_obj.read()
except (TypeError, IOError):
text_output = self.UNKNOWN
system_out_cdata_content = self._escape_cdata(text_output)
system_out_cdata = document.createCDATASection(system_out_cdata_content) system_out_cdata = document.createCDATASection(system_out_cdata_content)
system_out.appendChild(system_out_cdata) system_out.appendChild(system_out_cdata)
element.appendChild(system_out) element.appendChild(system_out)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册