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.
This commit is contained in:
Florian Bruhin 2015-11-23 20:12:52 +01:00
parent d4c24c935c
commit 607ca0f478
2 changed files with 3 additions and 0 deletions

View File

@ -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],

View File

@ -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()