Fix config things relying on dict order

This commit is contained in:
Florian Bruhin 2017-07-04 07:41:40 +02:00
parent 8933b4c5da
commit 0528a800f2
4 changed files with 6 additions and 6 deletions

View File

@ -480,7 +480,7 @@ class Config(QObject):
The changed config part as string. The changed config part as string.
""" """
lines = [] lines = []
for optname, value in self._values.items(): for optname, value in sorted(self._values.items()):
opt = self.get_opt(optname) opt = self.get_opt(optname)
str_value = opt.typ.to_str(value) str_value = opt.typ.to_str(value)
lines.append('{} = {}'.format(optname, str_value)) lines.append('{} = {}'.format(optname, str_value))

View File

@ -129,7 +129,7 @@ def _parse_yaml_backends_dict(name, node):
'Qt 5.8': qtutils.version_check('5.8'), 'Qt 5.8': qtutils.version_check('5.8'),
'Qt 5.9': qtutils.version_check('5.9'), 'Qt 5.9': qtutils.version_check('5.9'),
} }
for key in node.keys(): for key in sorted(node.keys()):
if conditionals[node[key]]: if conditionals[node[key]]:
backends.append(str_to_backend[key]) backends.append(str_to_backend[key])

View File

@ -743,8 +743,8 @@ class TestConfig:
def test_dump_userconfig(self, conf): def test_dump_userconfig(self, conf):
conf.set_obj('content.plugins', True) conf.set_obj('content.plugins', True)
conf.set_obj('content.headers.custom', {'X-Foo': 'bar'}) conf.set_obj('content.headers.custom', {'X-Foo': 'bar'})
lines = ['content.plugins = true', lines = ['content.headers.custom = {"X-Foo": "bar"}',
'content.headers.custom = {"X-Foo": "bar"}'] 'content.plugins = true']
assert conf.dump_userconfig().splitlines() == lines assert conf.dump_userconfig().splitlines() == lines
def test_dump_userconfig_default(self, conf): def test_dump_userconfig_default(self, conf):

View File

@ -219,8 +219,8 @@ class TestParseYamlBackend:
assert backends == expected assert backends == expected
@pytest.mark.parametrize('webkit, has_new_version, expected', [ @pytest.mark.parametrize('webkit, has_new_version, expected', [
(True, True, [usertypes.Backend.QtWebKit, (True, True, [usertypes.Backend.QtWebEngine,
usertypes.Backend.QtWebEngine]), usertypes.Backend.QtWebKit]),
(False, True, [usertypes.Backend.QtWebEngine]), (False, True, [usertypes.Backend.QtWebEngine]),
(True, False, [usertypes.Backend.QtWebKit]), (True, False, [usertypes.Backend.QtWebKit]),
]) ])