force_store_value works now with permissive
This commit is contained in:
parent
a3e28392b0
commit
5fd62e2a96
@ -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'
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user