提交 4e5640df 编写于 作者: C Cleber Rosa

HTML Result: add missing fields to formatted version of test info

Commit 84a8acc0 fixed a problem with 625eefe0, by reverting its
original proposal and copying everything from the inner test result
information to a new dict that is fed to the report template.

It turns out that only two entries were missing (test ID and status)
so we don't really need to copy the whole thing.

Again, this is basically a revert of 84a8acc0 that adds those two
missing fields.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 4fdb2df6
......@@ -130,20 +130,21 @@ class ReportModel(object):
"INTERRUPTED": "danger"}
test_info = []
results_dir = self.results_dir(False)
for tst in self.result.tests:
tst = tst.copy() # we don't want to override other's results
tst["test"] = str(tst["name"])
logdir = os.path.join(results_dir, 'test-results', tst['logdir'])
tst['logdir'] = os.path.relpath(logdir, self.html_output_dir)
for t in self.result.tests:
formatted = {}
formatted['name'] = t['name']
formatted['status'] = t['status']
logdir = os.path.join(results_dir, 'test-results', t['logdir'])
formatted['logdir'] = os.path.relpath(logdir, self.html_output_dir)
logfile = os.path.join(logdir, 'debug.log')
tst['logfile'] = os.path.relpath(logfile, self.html_output_dir)
tst['logfile_basename'] = os.path.basename(logfile)
tst['time'] = "%.2f" % tst['time_elapsed']
tst['time_start'] = time.strftime("%Y-%m-%d %H:%M:%S",
time.localtime(tst['time_start']))
tst['row_class'] = mapping[tst['status']]
formatted['logfile'] = os.path.relpath(logfile, self.html_output_dir)
formatted['logfile_basename'] = os.path.basename(logfile)
formatted['time'] = "%.2f" % t['time_elapsed']
formatted['time_start'] = time.strftime("%Y-%m-%d %H:%M:%S",
time.localtime(t['time_start']))
formatted['row_class'] = mapping[t['status']]
exhibition_limit = 40
fail_reason = tst.get('fail_reason')
fail_reason = t.get('fail_reason')
if fail_reason is None:
fail_reason = '<unknown>'
fail_reason = str(fail_reason)
......@@ -155,8 +156,8 @@ class ReportModel(object):
'data-content="%s">%s...</a>' %
('fail_reason',
'fail_reason'[:exhibition_limit]))
tst['fail_reason'] = fail_reason
test_info.append(tst)
formatted['fail_reason'] = fail_reason
test_info.append(formatted)
return test_info
def _sysinfo_phase(self, phase):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册