diff --git a/tests/conftest.py b/tests/conftest.py index 302d08864..da034f5f2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -35,7 +35,8 @@ from helpers import logfail from helpers.logfail import fail_on_logging from helpers.messagemock import message_mock from helpers.fixtures import * -from qutebrowser.utils import qtutils, standarddir +from qutebrowser.utils import qtutils, standarddir, usertypes +from qutebrowser.misc import objects import qutebrowser.app # To register commands @@ -184,6 +185,14 @@ def check_display(request): raise Exception("No display and no Xvfb available!") +@pytest.fixture(autouse=True) +def set_backend(monkeypatch, request): + """Make sure the backend global is set.""" + backend = (usertypes.Backend.QtWebEngine if request.config.webengine + else usertypes.Backend.QtWebKit) + monkeypatch.setattr(objects, 'backend', backend) + + @pytest.hookimpl(tryfirst=True, hookwrapper=True) def pytest_runtest_makereport(item, call): """Make test information available in fixtures.