Skip to content

Commit

Permalink
Merge pull request #5045 from dalthviz/fixes_issue_4921
Browse files Browse the repository at this point in the history
PR: Allow values with '%' in config system
  • Loading branch information
ccordoba12 authored Aug 26, 2017
2 parents 13cc5ab + 072789f commit f2e3018
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions spyder/config/tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def userconfig(tmpdir, monkeypatch):
return UserConfig('foo', defaults={}, subfolder=True,
version='1.0.0', raw_mode=True)


def test_userconfig_set_percentage_string(userconfig):
"""Test to set an option with a '%'."""
userconfig.set('section', 'option', '%value')
assert userconfig.get('section', 'option') == '%value'


def test_userconfig_get_string_from_inifile(userconfig):
assert userconfig.get('section', 'option') == 'value'

Expand Down
5 changes: 4 additions & 1 deletion spyder/config/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ class DefaultsConfig(cp.ConfigParser):
UserConfig
"""
def __init__(self, name, subfolder):
cp.ConfigParser.__init__(self)
if PY2:
cp.ConfigParser.__init__(self)
else:
cp.ConfigParser.__init__(self, interpolation=None)
self.name = name
self.subfolder = subfolder

Expand Down

0 comments on commit f2e3018

Please sign in to comment.