Skip to content

Commit

Permalink
Fix config values being lost with DELETED_OPTIONS
Browse files Browse the repository at this point in the history
When an option was deleted, we accidentally stopped reading instead of
ignoring that one option and then resuming.
  • Loading branch information
The-Compiler committed Jul 14, 2016
1 parent 325846f commit 7b9d38e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.asciidoc
Expand Up @@ -44,6 +44,12 @@ Changed
- New `taskadd` userscript to add a taskwarrior task annotated with the - New `taskadd` userscript to add a taskwarrior task annotated with the
current URL. current URL.
Fixed
-----

- Fixed some configuration values being lost when a config option gets removed
from qutebrowser's code.
Removed Removed
------- -------


Expand Down
2 changes: 1 addition & 1 deletion qutebrowser/config/config.py
Expand Up @@ -518,7 +518,7 @@ def _from_cp_section(self, sectname, cp, relaxed):
k = k[1:] k = k[1:]


if (sectname, k) in self.DELETED_OPTIONS: if (sectname, k) in self.DELETED_OPTIONS:
return continue
if (sectname, k) in self.RENAMED_OPTIONS: if (sectname, k) in self.RENAMED_OPTIONS:
k = self.RENAMED_OPTIONS[sectname, k] k = self.RENAMED_OPTIONS[sectname, k]
if (sectname, k) in self.CHANGED_OPTIONS: if (sectname, k) in self.CHANGED_OPTIONS:
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/config/test_config.py
Expand Up @@ -198,6 +198,17 @@ def test_deleted_options(self, section, option):
"""Make sure renamed options don't exist anymore.""" """Make sure renamed options don't exist anymore."""
assert option not in configdata.DATA[section] 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: class TestKeyConfigParser:


Expand Down

0 comments on commit 7b9d38e

Please sign in to comment.