Fix test_models.py
The Config object got initialized via the config_stub fixture early, so we need to force it to re-init its values after patching configdata.DATA.
This commit is contained in:
parent
19f7b92abb
commit
75181e16fa
@ -253,7 +253,10 @@ class Config(QObject):
|
||||
self.changed.connect(_render_stylesheet.cache_clear)
|
||||
self._mutables = {}
|
||||
self._yaml = yaml_config
|
||||
self._init_values()
|
||||
|
||||
def _init_values(self):
|
||||
"""Populate the self._values dict."""
|
||||
self._values = {}
|
||||
for name, opt in configdata.DATA.items():
|
||||
self._values[name] = configutils.Values(opt)
|
||||
|
@ -80,9 +80,9 @@ def cmdutils_stub(monkeypatch, stubs):
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def configdata_stub(monkeypatch, configdata_init):
|
||||
def configdata_stub(config_stub, monkeypatch, configdata_init):
|
||||
"""Patch the configdata module to provide fake data."""
|
||||
return monkeypatch.setattr(configdata, 'DATA', collections.OrderedDict([
|
||||
monkeypatch.setattr(configdata, 'DATA', collections.OrderedDict([
|
||||
('aliases', configdata.Option(
|
||||
name='aliases',
|
||||
description='Aliases for commands.',
|
||||
@ -132,6 +132,7 @@ def configdata_stub(monkeypatch, configdata_init):
|
||||
backends=[],
|
||||
raw_backends=None)),
|
||||
]))
|
||||
config_stub._init_values()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
Loading…
Reference in New Issue
Block a user