ValueError if not PropertieError
This commit is contained in:
parent
d959020eed
commit
057bba83e4
@ -3,6 +3,8 @@ Sat Apr 18 22:42:53 2015 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
Settings) to validate value with those object. Now value with
|
||||
callback and consistency are correctly validate
|
||||
* ability to disable warnings validation
|
||||
* if ValueError and PropertieError together, should raise with
|
||||
PropertieError
|
||||
|
||||
Sun Mar 8 12:02:17 2015 +0200 Emmanuel Garette <egarette@cadoles.com>
|
||||
* valid default/callback value in consistencies
|
||||
|
@ -843,6 +843,20 @@ def test_callback_two_disabled2():
|
||||
assert cfg.getowner(opt2, force_permissive=True) == owners.default
|
||||
|
||||
|
||||
def test_callback_calculating_invalid():
|
||||
opt1 = IntOption('opt1', '', 1)
|
||||
opt2 = BoolOption('opt2', '', callback=return_value, callback_params={'': ((opt1, False),)})
|
||||
od1 = OptionDescription('od1', '', [opt1])
|
||||
od2 = OptionDescription('od2', '', [opt2])
|
||||
maconfig = OptionDescription('rootconfig', '', [od1, od2])
|
||||
cfg = Config(maconfig)
|
||||
setting = cfg.cfgimpl_get_settings()
|
||||
cfg.read_write()
|
||||
raises(ValueError, 'cfg.od2.opt2')
|
||||
setting[opt2].append('disabled')
|
||||
raises(PropertiesOptionError, 'cfg.od2.opt2')
|
||||
|
||||
|
||||
def test_callback_calculating_disabled():
|
||||
opt1 = BoolOption('opt1', '', properties=('disabled',))
|
||||
opt2 = BoolOption('opt2', '', callback=return_value, callback_params={'': ((opt1, False),)})
|
||||
|
@ -300,10 +300,15 @@ class Values(object):
|
||||
force_submulti_index = submulti_index
|
||||
if setting_properties is undefined:
|
||||
setting_properties = setting._getproperties()
|
||||
opt.impl_validate(value, context,
|
||||
'validator' in setting_properties,
|
||||
force_index=force_index,
|
||||
force_submulti_index=force_submulti_index)
|
||||
try:
|
||||
opt.impl_validate(value, context,
|
||||
'validator' in setting_properties,
|
||||
force_index=force_index,
|
||||
force_submulti_index=force_submulti_index)
|
||||
except ValueError, err:
|
||||
config_error = err
|
||||
value = None
|
||||
|
||||
#FIXME pas de test avec les metas ...
|
||||
#FIXME et les symlinkoption ...
|
||||
if is_default and 'force_store_value' in setting._getitem(opt,
|
||||
|
Loading…
Reference in New Issue
Block a user