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.
"""
lines = []
for optname, value in self._values.items():
for optname, value in sorted(self._values.items()):
opt = self.get_opt(optname)
str_value = opt.typ.to_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.9': qtutils.version_check('5.9'),
}
for key in node.keys():
for key in sorted(node.keys()):
if conditionals[node[key]]:
backends.append(str_to_backend[key])

View File

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

View File

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