Fix test_mhtml_e2e with Qt 5.11

See #3661
This commit is contained in:
Florian Bruhin 2018-03-05 11:36:29 +01:00
parent cc5da4d1fe
commit 2f8686ec70
2 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,5 @@
From: <Saved by Blink>
Snapshot-Content-Location: http://localhost:(port)/data/downloads/mhtml/simple/simple.html
Subject: Simple MHTML test
Date: today
MIME-Version: 1.0

View File

@ -26,6 +26,8 @@ import collections
import pytest
from qutebrowser.utils import qtutils
def collect_tests():
basedir = os.path.dirname(__file__)
@ -51,6 +53,11 @@ def normalize_line(line):
line = line.replace('Content-Type: application/x-javascript',
'Content-Type: application/javascript')
# Added with Qt 5.11
if (line.startswith('Snapshot-Content-Location: ') and
not qtutils.version_check('5.11', compiled=False)):
line = None
return line
@ -74,7 +81,8 @@ class DownloadDir:
def compare_mhtml(self, filename):
with open(filename, 'r', encoding='utf-8') as f:
expected_data = [normalize_line(line) for line in f]
expected_data = [normalize_line(line) for line in f
if normalize_line(line) is not None]
actual_data = self.read_file()
actual_data = [normalize_line(line) for line in actual_data]
assert actual_data == expected_data