Use a real YAML config for config tests

This commit is contained in:
Florian Bruhin 2017-10-03 13:05:01 +02:00
parent ed8c3f4aa2
commit 9383452ab9
2 changed files with 3 additions and 10 deletions

View File

@ -417,9 +417,6 @@ class FakeYamlConfig:
self.loaded = False self.loaded = False
self._values = {} self._values = {}
def load(self):
self.loaded = True
def __contains__(self, item): def __contains__(self, item):
return item in self._values return item in self._values

View File

@ -25,7 +25,7 @@ import pytest
from PyQt5.QtCore import QObject from PyQt5.QtCore import QObject
from PyQt5.QtGui import QColor from PyQt5.QtGui import QColor
from qutebrowser.config import config, configdata, configexc from qutebrowser.config import config, configdata, configexc, configfiles
from qutebrowser.utils import usertypes from qutebrowser.utils import usertypes
from qutebrowser.misc import objects from qutebrowser.misc import objects
@ -258,8 +258,8 @@ class TestKeyConfig:
class TestConfig: class TestConfig:
@pytest.fixture @pytest.fixture
def conf(self, stubs): def conf(self, config_tmpdir):
yaml_config = stubs.FakeYamlConfig() yaml_config = configfiles.YamlConfig()
return config.Config(yaml_config) return config.Config(yaml_config)
def test_set_value(self, qtbot, conf, caplog): def test_set_value(self, qtbot, conf, caplog):
@ -330,12 +330,8 @@ class TestConfig:
assert conf._yaml[name2] is True assert conf._yaml[name2] is True
def test_read_yaml(self, conf): def test_read_yaml(self, conf):
assert not conf._yaml.loaded
conf._yaml['content.plugins'] = True conf._yaml['content.plugins'] = True
conf.read_yaml() conf.read_yaml()
assert conf._yaml.loaded
assert conf._values['content.plugins'] is True assert conf._values['content.plugins'] is True
def test_get_opt_valid(self, conf): def test_get_opt_valid(self, conf):