Decode all bytes strings in extra text.
This commit is contained in:
parent
40e0ec3d1c
commit
e9b2433549
|
@ -198,6 +198,8 @@ class HTMLReport(object):
|
|||
|
||||
elif extra.get('format') == extras.FORMAT_TEXT:
|
||||
content = extra.get('content')
|
||||
if isinstance(content, bytes):
|
||||
content = content.decode("utf-8")
|
||||
if self.self_contained:
|
||||
href = data_uri(content)
|
||||
else:
|
||||
|
|
|
@ -238,7 +238,8 @@ class TestHTML:
|
|||
|
||||
@pytest.mark.parametrize('content, encoded', [
|
||||
("u'\u0081'", 'woE='),
|
||||
("'foo'", 'Zm9v')])
|
||||
("'foo'", 'Zm9v'),
|
||||
("b'\\xe2\\x80\\x93'", "4oCT")])
|
||||
def test_extra_text(self, testdir, content, encoded):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
@ -325,7 +326,8 @@ class TestHTML:
|
|||
src = 'data:{0};base64,{1}'.format(mime_type, content)
|
||||
assert '<img src="{0}"/>'.format(src) in html
|
||||
|
||||
@pytest.mark.parametrize('content', [("u'\u0081'"), ("'foo'")])
|
||||
@pytest.mark.parametrize('content', [("u'\u0081'"), ("'foo'"),
|
||||
("b'\\xe2\\x80\\x93'")])
|
||||
def test_extra_text_separated(self, testdir, content):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
|
Loading…
Reference in New Issue