Turn off SQL history writing during end2end tests
This hopefully makes them a bit faster, and also should help with weird hangs we had in tests.
This commit is contained in:
parent
f6d878f33f
commit
f85f4630ff
@ -132,7 +132,7 @@ class WebHistory(sql.SqlTable):
|
||||
self._do_clear()
|
||||
else:
|
||||
message.confirm_async(self._do_clear, title="Clear all browsing "
|
||||
"history?")
|
||||
"history?")
|
||||
|
||||
def _do_clear(self):
|
||||
self.delete_all()
|
||||
@ -177,6 +177,9 @@ class WebHistory(sql.SqlTable):
|
||||
log.misc.warning("Ignoring invalid URL being added to history")
|
||||
return
|
||||
|
||||
if 'no-sql-history' in objreg.get('args').debug_flags:
|
||||
return
|
||||
|
||||
atime = int(atime) if (atime is not None) else int(time.time())
|
||||
self.insert({'url': self._format_url(url),
|
||||
'title': title,
|
||||
|
@ -150,7 +150,7 @@ def debug_flag_error(flag):
|
||||
debug-exit: Turn on debugging of late exit.
|
||||
pdb-postmortem: Drop into pdb on exceptions.
|
||||
"""
|
||||
valid_flags = ['debug-exit', 'pdb-postmortem']
|
||||
valid_flags = ['debug-exit', 'pdb-postmortem', 'no-sql-history']
|
||||
|
||||
if flag in valid_flags:
|
||||
return flag
|
||||
|
@ -20,11 +20,19 @@
|
||||
import logging
|
||||
import re
|
||||
|
||||
import pytest
|
||||
import pytest_bdd as bdd
|
||||
|
||||
bdd.scenarios('history.feature')
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def turn_on_sql_history(quteproc):
|
||||
"""Make sure SQL writing is enabled for tests in this module."""
|
||||
quteproc.send_cmd(":debug-pyeval objreg.get('args').debug_flags.remove('no-sql-history')")
|
||||
quteproc.wait_for_load_finished_url('qute://pyeval')
|
||||
|
||||
|
||||
@bdd.then(bdd.parsers.parse("the history should contain:\n{expected}"))
|
||||
def check_history(quteproc, httpbin, tmpdir, expected):
|
||||
path = tmpdir / 'history'
|
||||
|
@ -401,7 +401,8 @@ class QuteProc(testprocess.Process):
|
||||
backend = 'webengine' if self.request.config.webengine else 'webkit'
|
||||
return ['--debug', '--no-err-windows', '--temp-basedir',
|
||||
'--json-logging', '--loglevel', 'vdebug',
|
||||
'--backend', backend, 'about:blank']
|
||||
'--backend', backend, '--debug-flag', 'no-sql-history',
|
||||
'about:blank']
|
||||
|
||||
def path_to_url(self, path, *, port=None, https=False):
|
||||
"""Get a URL based on a filename for the localhost webserver.
|
||||
|
Loading…
Reference in New Issue
Block a user