Add message_bridge fixture

This commit is contained in:
Florian Bruhin 2018-10-16 10:59:55 +02:00
parent 965a2e2806
commit 552db64028
2 changed files with 11 additions and 2 deletions

View File

@ -35,7 +35,7 @@ pytest.register_assert_rewrite('helpers')
from helpers import logfail
from helpers.logfail import fail_on_logging
from helpers.messagemock import message_mock
from helpers.messagemock import message_mock, message_bridge
from helpers.fixtures import * # noqa: F403
from qutebrowser.utils import qtutils, standarddir, usertypes, utils, version
from qutebrowser.misc import objects

View File

@ -24,7 +24,7 @@ import logging
import attr
import pytest
from qutebrowser.utils import usertypes, message
from qutebrowser.utils import usertypes, message, objreg
@attr.s
@ -90,3 +90,12 @@ def message_mock():
mmock.patch()
yield mmock
mmock.unpatch()
@pytest.fixture
def message_bridge(win_registry):
"""Fixture to get a MessageBridge."""
bridge = message.MessageBridge()
objreg.register('message-bridge', bridge, scope='window', window=0)
yield bridge
objreg.delete('message-bridge', scope='window', window=0)