Fix config values being lost with DELETED_OPTIONS

When an option was deleted, we accidentally stopped reading instead of
ignoring that one option and then resuming.
This commit is contained in:
Florian Bruhin 2016-07-14 16:58:54 +02:00
parent 325846f20a
commit 7b9d38e438
3 changed files with 18 additions and 1 deletions

View File

@ -44,6 +44,12 @@ Changed
- New `taskadd` userscript to add a taskwarrior task annotated with the
current URL.
Fixed
-----
- Fixed some configuration values being lost when a config option gets removed
from qutebrowser's code.
Removed
-------

View File

@ -518,7 +518,7 @@ class ConfigManager(QObject):
k = k[1:]
if (sectname, k) in self.DELETED_OPTIONS:
return
continue
if (sectname, k) in self.RENAMED_OPTIONS:
k = self.RENAMED_OPTIONS[sectname, k]
if (sectname, k) in self.CHANGED_OPTIONS:

View File

@ -198,6 +198,17 @@ class TestConfigParser:
"""Make sure renamed options don't exist anymore."""
assert option not in configdata.DATA[section]
def test_config_reading_with_deleted_options(self, objects):
"""Test an invalid option with relaxed=True."""
objects.cp.read_dict({
'general': collections.OrderedDict(
[('wrap-search', 'true'), ('save-session', 'true')])
})
objects.cfg._from_cp(objects.cp)
with pytest.raises(configexc.NoOptionError):
objects.cfg.get('general', 'wrap-search')
assert objects.cfg.get('general', 'save-session')
class TestKeyConfigParser: