From 49c4d6868fee373493fa94204493420d5563c2c7 Mon Sep 17 00:00:00 2001 From: superdodd Date: Fri, 27 Mar 2020 22:42:01 -0700 Subject: [PATCH 1/2] Add missing image/video tag For image/video attachments that are not added as files, the non-self-contained html report does not show the image next to the test log as expected. The div and link where the image/video goes is created, but no image or video element is inserted. --- pytest_html/plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pytest_html/plugin.py b/pytest_html/plugin.py index 8cd72b63..173bc77e 100644 --- a/pytest_html/plugin.py +++ b/pytest_html/plugin.py @@ -319,7 +319,10 @@ def _make_media_html_div( href = src = self.create_asset( content, extra_index, test_index, extra.get("extension"), "wb" ) - html_div = html.a(class_=base_extra_class, target="_blank", href=href) + html_div = html.a( + raw(base_extra_string.format(href)), + class_=base_extra_class, target="_blank", href=href + ) return html_div def _append_image(self, extra, extra_index, test_index): From e0d529e99eb1da2490d41827fc7cc921262d49d3 Mon Sep 17 00:00:00 2001 From: superdodd Date: Fri, 27 Mar 2020 22:56:08 -0700 Subject: [PATCH 2/2] Linting fix --- pytest_html/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytest_html/plugin.py b/pytest_html/plugin.py index 173bc77e..0f52fea2 100644 --- a/pytest_html/plugin.py +++ b/pytest_html/plugin.py @@ -321,7 +321,9 @@ def _make_media_html_div( ) html_div = html.a( raw(base_extra_string.format(href)), - class_=base_extra_class, target="_blank", href=href + class_=base_extra_class, + target="_blank", + href=href ) return html_div