diff --git a/config.py b/config.py index fd5c145..dab6dfc 100644 --- a/config.py +++ b/config.py @@ -330,6 +330,7 @@ class Config(object): child.setowner(self, ['default' for i in range(len(child.getdefault()))]) else: child.setowner(self, 'default') + self._cfgimpl_values[name] = child.getdefault() else: child.setowner(self, newowner) else: diff --git a/test/test_option_owner.py b/test/test_option_owner.py index 400a766..829ddf6 100644 --- a/test/test_option_owner.py +++ b/test/test_option_owner.py @@ -7,7 +7,28 @@ from error import SpecialOwnersError def make_description(): gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref') - ## dummy 1 + gcdummy = BoolOption('dummy', 'dummy', default=False, callback="toto") + objspaceoption = ChoiceOption('objspace', 'Object space', + ['std', 'thunk'], 'std') + booloption = BoolOption('bool', 'Test boolean option', default=True) + intoption = IntOption('int', 'Test int option', default=0) + floatoption = FloatOption('float', 'Test float option', default=2.3) + stroption = StrOption('str', 'Test string option', default="abc") + boolop = BoolOption('boolop', 'Test boolean option op', default=True) + wantref_option = BoolOption('wantref', 'Test requires', default=False, + requires=['boolop']) + wantframework_option = BoolOption('wantframework', 'Test requires', + default=False, + requires=['boolop']) + gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption]) + descr = OptionDescription('constraints', '', [gcgroup, booloption, objspaceoption, + wantref_option, stroption, + wantframework_option, + intoption, boolop]) + return descr + +def make_description2(): + gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref') gcdummy = BoolOption('dummy', 'dummy', default=False) objspaceoption = ChoiceOption('objspace', 'Object space', ['std', 'thunk'], 'std') @@ -30,9 +51,9 @@ def make_description(): def test_override_are_default_owner(): "config.override() implies that the owner is 'default' again" - descr = make_description() + descr = make_description2() config = Config(descr, bool=False) - # defaut + # default assert config.gc._cfgimpl_value_owners['dummy'] == 'default' # user config.gc.dummy = True diff --git a/test/test_option_setting.py b/test/test_option_setting.py index c29f00e..ec39fad 100644 --- a/test/test_option_setting.py +++ b/test/test_option_setting.py @@ -47,7 +47,7 @@ def test_reset(): assert config.string == "foo" assert config._cfgimpl_value_owners['string'] == 'user' config.string = None - assert config.string == None + assert config.string == 'string' assert config._cfgimpl_value_owners['string'] == 'default' def test_idontexist():