From d3e8d46593e7a427f343ae02f17d598c5f99a66a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 19 Feb 2018 15:25:11 +0100 Subject: [PATCH] Use a real YamlConfig for tests --- tests/helpers/fixtures.py | 7 ++++--- tests/helpers/stubs.py | 27 --------------------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 686db4125..193a40a8a 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -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) diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index 64bc793cb..5a74b6a43 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -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."""