From 7f33b941d5f834a7a8cb4c0683b622b95d91a1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Wed, 24 Aug 2016 10:57:20 +0200 Subject: [PATCH] avocado.core.html: Show link to file which failed to processed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sysinfo collection can sometimes fail. Let's log a link along with reason instead of an empty line. Signed-off-by: Lukáš Doktor --- avocado/core/html.py | 12 +++++++----- .../resources/htmlresult/templates/report.mustache | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/avocado/core/html.py b/avocado/core/html.py index 19e1b2b7..71560b34 100644 --- a/avocado/core/html.py +++ b/avocado/core/html.py @@ -176,15 +176,17 @@ class ReportModel(object): for s_f in sysinfo_files: sysinfo_dict = {} sysinfo_path = os.path.join(base_path, s_f) + sysinfo_dict['file'] = " ".join(s_f.split("_")) + sysinfo_dict['element_id'] = '%s_heading_%s' % (phase, s_id) + sysinfo_dict['collapse_id'] = '%s_collapse_%s' % (phase, s_id) try: with codecs.open(sysinfo_path, 'r', encoding="utf-8") as sysinfo_file: - sysinfo_dict['file'] = " ".join(s_f.split("_")) sysinfo_dict['contents'] = sysinfo_file.read() - sysinfo_dict['element_id'] = '%s_heading_%s' % (phase, s_id) - sysinfo_dict['collapse_id'] = '%s_collapse_%s' % (phase, s_id) except (OSError, UnicodeDecodeError) as details: - sysinfo_dict[s_f] = ('Error reading sysinfo file %s: %s' % - (sysinfo_path, details)) + path = os.path.relpath(sysinfo_path, self.html_output_dir) + sysinfo_dict['err'] = ("Error reading sysinfo file, check out" + "the file %s: %s" + % (path, path, details)) sysinfo_list.append(sysinfo_dict) s_id += 1 return sysinfo_list diff --git a/avocado/core/resources/htmlresult/templates/report.mustache b/avocado/core/resources/htmlresult/templates/report.mustache index fd4fc506..43617e2d 100644 --- a/avocado/core/resources/htmlresult/templates/report.mustache +++ b/avocado/core/resources/htmlresult/templates/report.mustache @@ -101,6 +101,7 @@
{{contents}}
+ {{& err}}
-- GitLab