Clean up objreg properly in config tests

This commit is contained in:
Florian Bruhin 2017-07-03 14:28:04 +02:00
parent 54adf3898a
commit f8a88ae042
2 changed files with 14 additions and 2 deletions

View File

@ -827,6 +827,10 @@ def init_patch(qapp, fake_save_manager, monkeypatch, config_tmpdir,
yield
objreg.delete('config')
objreg.delete('config-commands')
try:
objreg.delete('state-config')
except KeyError:
pass
def test_init(init_patch, fake_save_manager, config_tmpdir):

View File

@ -22,6 +22,7 @@
import pytest
from qutebrowser.config import configfiles
from qutebrowser.utils import objreg
from PyQt5.QtCore import QSettings
@ -86,8 +87,15 @@ def test_yaml_config(fake_save_manager, config_tmpdir, old_config, insert):
assert ' tabs.show: never' in lines
def test_init(qapp, fake_save_manager, config_tmpdir, data_tmpdir,
config_stub):
@pytest.fixture
def init_patch(qapp, fake_save_manager, config_tmpdir, data_tmpdir,
config_stub):
yield
objreg.delete('state-config')
objreg.delete('command-history')
def test_init(init_patch, config_tmpdir):
configfiles.init(config=None)
# Make sure qsettings land in a subdir