From 30e2afb59d5622046d547f287cc5870b11a4ca43 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 12 Nov 2015 13:17:10 +0100 Subject: [PATCH] mhtml: reduce test flakiness Waiting for "All assets downloaded" may lead to race conditions when the output file is read before qute wrote it, so the test fails. --- qutebrowser/browser/mhtml.py | 1 + tests/integration/test_mhtml_e2e.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/mhtml.py b/qutebrowser/browser/mhtml.py index 9b0e1d200..e814db963 100644 --- a/qutebrowser/browser/mhtml.py +++ b/qutebrowser/browser/mhtml.py @@ -436,6 +436,7 @@ class _Downloader(): self.writer.write_to(file_output) finally: file_output.close() + log.downloads.debug("File successfully written.") message.info(self._win_id, "Page saved as {}".format(self.dest)) def collect_zombies(self): diff --git a/tests/integration/test_mhtml_e2e.py b/tests/integration/test_mhtml_e2e.py index c3185c007..fedf6bd69 100644 --- a/tests/integration/test_mhtml_e2e.py +++ b/tests/integration/test_mhtml_e2e.py @@ -86,7 +86,7 @@ def test_mhtml(test_name, download_dir, quteproc, httpbin): quteproc.send_cmd(':download --mhtml --dest "{}"'.format(download_dest)) quteproc.wait_for(category='downloads', module='mhtml', function='finish_file', - message='All assets downloaded, ready to finish off!') + message='File successfully written.') expected_file = os.path.join(test_dir, '{}.mht'.format(test_name)) download_dir.compare_mhtml(expected_file)