From 607ca0f478a34b556bcad6f9b8931654bdd21489 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 23 Nov 2015 20:12:52 +0100 Subject: [PATCH] tests: Wait until page is dumped for header check. If we don't do this, it's possible for the test process to delete the temporary directory before qutebrowser actually writes the file. --- qutebrowser/browser/commands.py | 1 + tests/integration/quteprocess.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 16e28ccb9..8456fd132 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1242,6 +1242,7 @@ class CommandDispatcher: data = mainframe.toHtml() with open(dest, 'w', encoding='utf-8') as f: f.write(data) + message.info(self._win_id, "Dumped page to {}.".format(dest)) @cmdutils.register(instance='command-dispatcher', name='help', completion=[usertypes.Completion.helptopic], diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index f080e22b0..235d78fa2 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -268,6 +268,8 @@ class QuteProc(testprocess.Process): with tempfile.TemporaryDirectory() as tmpdir: path = os.path.join(tmpdir, 'page') self.send_cmd(':debug-dump-page --plain "{}"'.format(path)) + self.wait_for(category='message', loglevel=logging.INFO, + message='Dumped page to {}.'.format(path)) with open(path, 'r', encoding='utf-8') as f: return f.read()