From 712db2875e0dac7c7e0d6c88b551d4bdff2992c6 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 28 Mar 2014 17:35:27 +0100 Subject: [PATCH] force_store_value works now with permissive --- test/test_freeze.py | 13 ++++++++++++- tiramisu/value.py | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/test/test_freeze.py b/test/test_freeze.py index cda1406..f279c47 100644 --- a/test/test_freeze.py +++ b/test/test_freeze.py @@ -22,13 +22,14 @@ def make_description_freeze(): boolop = BoolOption('boolop', 'Test boolean option op', default=[True], multi=True) wantref_option = BoolOption('wantref', 'Test requires', default=False, properties=('force_store_value',), requires=({'option': booloption, 'expected': True, 'action': 'hidden'},)) + wantref2_option = BoolOption('wantref2', 'Test requires', default=False, properties=('force_store_value', 'hidden')) wantframework_option = BoolOption('wantframework', 'Test requires', default=False, requires=({'option': booloption, 'expected': True, 'action': 'hidden'},)) gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption]) descr = OptionDescription('tiramisu', '', [gcgroup, booloption, objspaceoption, - wantref_option, stroption, + wantref_option, wantref2_option, stroption, wantframework_option, intoption, boolop]) return descr @@ -153,3 +154,13 @@ def test_force_store_value_ro(): assert conf.getowner(conf.unwrap_from_path('wantref')) == 'default' conf.wantref assert conf.getowner(conf.unwrap_from_path('wantref')) == 'user' + + +def test_force_store_value_hidden(): + descr = make_description_freeze() + conf = Config(descr) + conf.cfgimpl_get_settings().setpermissive(('hidden',)) + conf.read_write() + assert conf.getowner(conf.unwrap_from_path('wantref2')) == 'default' + conf._getattr('wantref2', force_permissive=True) + assert conf.getowner(conf.unwrap_from_path('wantref2')) == 'user' diff --git a/tiramisu/value.py b/tiramisu/value.py index 968f0e4..d66f85d 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -243,7 +243,8 @@ class Values(object): opt.impl_validate(value, context, 'validator' in setting) if config_error is None and self._is_default_owner(path) and \ 'force_store_value' in setting[opt]: - self.setitem(opt, value, path, is_write=False) + self.setitem(opt, value, path, is_write=False, + force_permissive=force_permissive) if validate_properties: setting.validate_properties(opt, False, False, value=value, path=path, force_permissive=force_permissive,