tests: Add a tab fixture in test_tab

This commit is contained in:
Florian Bruhin 2016-07-13 13:46:33 +02:00
parent 558ef290e4
commit 4f97b6342d

View File

@ -62,6 +62,37 @@ def view(qtbot, config_stub, request):
qtbot.add_widget(v)
return v
@pytest.yield_fixture(params=['webkit', 'webengine'])
def tab(request, default_config, qtbot, tab_registry, cookiejar_and_cache):
if PYQT_VERSION < 0x050600:
pytest.skip('Causes segfaults, see #1638')
if PYQT_VERSION < 0x050600:
pytest.skip('Causes segfaults, see #1638')
if request.param == 'webkit':
webkittab = pytest.importorskip('qutebrowser.browser.webkit.webkittab')
tab_class = webkittab.WebKitTab
elif request.param == 'webengine':
webenginetab = pytest.importorskip(
'qutebrowser.browser.webengine.webenginetab')
tab_class = webenginetab.WebEngineTab
else:
assert False
# Can't use the mode_manager fixture as that uses config_stub, which
# conflicts with default_config
mm = modeman.ModeManager(0)
objreg.register('mode-manager', mm, scope='window', window=0)
t = tab_class(win_id=0, mode_manager=mm)
qtbot.add_widget(t)
yield t
objreg.delete('mode-manager', scope='window', window=0)
@pytest.mark.skipif(PYQT_VERSION < 0x050600,
reason='Causes segfaults, see #1638')
def test_tab(qtbot, view, config_stub, tab_registry):