Initialize monospace fonts in tests properly

See #2825
This commit is contained in:
Florian Bruhin 2017-09-11 21:51:04 +02:00
parent a60e932454
commit 40ee89bddc

View File

@ -38,7 +38,7 @@ import pytest
import py.path # pylint: disable=no-name-in-module
import helpers.stubs as stubsmod
from qutebrowser.config import config, configdata
from qutebrowser.config import config, configdata, configtypes, configexc
from qutebrowser.utils import objreg, standarddir
from qutebrowser.browser.webkit import cookies
from qutebrowser.misc import savemanager, sql
@ -218,6 +218,12 @@ def config_stub(stubs, monkeypatch, configdata_init):
container = config.ConfigContainer(conf)
monkeypatch.setattr(config, 'val', container)
try:
configtypes.Font.monospace_fonts = container.fonts.monospace
except configexc.NoOptionError:
# Completion tests patch configdata so fonts.monospace is unavailable.
pass
conf.val = container # For easier use in tests
return conf