Use a real YamlConfig for tests

This commit is contained in:
Florian Bruhin 2018-02-19 15:25:11 +01:00
parent cb631d532a
commit d3e8d46593
2 changed files with 4 additions and 30 deletions

View File

@ -42,7 +42,8 @@ from PyQt5.QtNetwork import QNetworkCookieJar
import helpers.stubs as stubsmod
import helpers.utils
from qutebrowser.config import config, configdata, configtypes, configexc
from qutebrowser.config import (config, configdata, configtypes, configexc,
configfiles)
from qutebrowser.utils import objreg, standarddir
from qutebrowser.browser.webkit import cookies
from qutebrowser.misc import savemanager, sql
@ -193,9 +194,9 @@ def configdata_init():
@pytest.fixture
def config_stub(stubs, monkeypatch, configdata_init):
def config_stub(stubs, monkeypatch, configdata_init, config_tmpdir):
"""Fixture which provides a fake config object."""
yaml_config = stubs.FakeYamlConfig()
yaml_config = configfiles.YamlConfig()
conf = config.Config(yaml_config=yaml_config)
monkeypatch.setattr(config, 'instance', conf)

View File

@ -406,33 +406,6 @@ class InstaTimer(QObject):
fun()
class FakeYamlConfig:
"""Fake configfiles.YamlConfig object."""
def __init__(self):
self.loaded = False
self._values = {}
def __contains__(self, item):
return item in self._values
def __iter__(self):
return iter(self._values.items())
def __setitem__(self, key, value):
self._values[key] = value
def __getitem__(self, key):
return self._values[key]
def unset(self, name):
self._values.pop(name, None)
def clear(self):
self._values = []
class StatusBarCommandStub(QLineEdit):
"""Stub for the statusbar command prompt."""