Avoid calling configdata.init() in tests
It takes unnecessary time (20ms without C extensions) to initialize it over and over again - and for some reason, it takes 20s (!) on Travis.
This commit is contained in:
parent
56ec5719a2
commit
8933b4c5da
@ -200,10 +200,16 @@ def cmdline_test(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def configdata_init():
|
||||
"""Initialize configdata if needed."""
|
||||
if configdata.DATA is None:
|
||||
configdata.init()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config_stub(stubs, monkeypatch):
|
||||
def config_stub(stubs, monkeypatch, configdata_init):
|
||||
"""Fixture which provides a fake config object."""
|
||||
configdata.init()
|
||||
yaml_config = stubs.FakeYamlConfig()
|
||||
|
||||
conf = config.Config(yaml_config=yaml_config)
|
||||
|
@ -31,8 +31,8 @@ from qutebrowser.utils import usertypes
|
||||
|
||||
def test_init(config_stub):
|
||||
"""Test reading the default yaml file and validating the values."""
|
||||
# configdata.init() is called by config_stub
|
||||
config_stub.val.aliases = {}
|
||||
configdata.init()
|
||||
assert isinstance(configdata.DATA, dict)
|
||||
assert 'ignore_case' in configdata.DATA
|
||||
for option in configdata.DATA.values():
|
||||
|
Loading…
Reference in New Issue
Block a user