Fix test_mhtml_e2e with QtWebKit + Qt 5.12

Fixup for 9eccaea09c
See #4025
This commit is contained in:
Florian Bruhin 2018-12-12 11:27:38 +01:00
parent 0953596ed6
commit aec348d929

View File

@ -61,8 +61,8 @@ def normalize_line(line):
return line
def normalize_whole(s):
if qtutils.version_check('5.12', compiled=False):
def normalize_whole(s, webengine):
if qtutils.version_check('5.12', compiled=False) and webengine:
s = s.replace('\n\n-----=_qute-UUID', '\n-----=_qute-UUID')
return s
@ -71,8 +71,9 @@ class DownloadDir:
"""Abstraction over a download directory."""
def __init__(self, tmpdir):
def __init__(self, tmpdir, config):
self._tmpdir = tmpdir
self._config = config
self.location = str(tmpdir)
def read_file(self):
@ -92,14 +93,15 @@ class DownloadDir:
if normalize_line(line) is not None)
actual_data = '\n'.join(normalize_line(line)
for line in self.read_file())
actual_data = normalize_whole(actual_data)
actual_data = normalize_whole(actual_data,
webengine=self._config.webengine)
assert actual_data == expected_data
@pytest.fixture
def download_dir(tmpdir):
return DownloadDir(tmpdir)
def download_dir(tmpdir, pytestconfig):
return DownloadDir(tmpdir, pytestconfig)
def _test_mhtml_requests(test_dir, test_path, server):