Permalink
Browse files

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.
  • Loading branch information...
The-Compiler committed Jul 14, 2016
1 parent 325846f commit 7b9d38e438189f33551e801ac31b44cd5a082e39
Showing with 18 additions and 1 deletion.
  1. +6 −0 CHANGELOG.asciidoc
  2. +1 −1 qutebrowser/config/config.py
  3. +11 −0 tests/unit/config/test_config.py
View
@@ -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
-------
@@ -518,7 +518,7 @@ def _from_cp_section(self, sectname, cp, relaxed):
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:
@@ -198,6 +198,17 @@ def test_deleted_options(self, section, option):
"""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:

0 comments on commit 7b9d38e

Please sign in to comment.