From 7bfa6679e350a5e0c3fee35da8466386267817d7 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 8 Sep 2018 22:51:27 +0200 Subject: [PATCH] mandatory_warnings: PropertiesOptionError in optiondescription stop validate mandatory warnings for followers options --- test/test_mandatory.py | 4 +++- tiramisu/value.py | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/test/test_mandatory.py b/test/test_mandatory.py index db2c711..1d360f5 100644 --- a/test/test_mandatory.py +++ b/test/test_mandatory.py @@ -12,6 +12,8 @@ from tiramisu.setting import groups def make_description(): + stro = StrOption('str', '') + subdescr = OptionDescription('sub', '', [stro], properties=('disabled',)) stroption = StrOption('str', 'Test string option', default="abc", properties=('mandatory', )) stroption1 = StrOption('str1', 'Test string option', @@ -22,7 +24,7 @@ def make_description(): properties=('mandatory', )) stroption4 = StrOption('str4', 'Test string option', multi=True, properties=('mandatory', ), allow_empty_list=True) - descr = OptionDescription('tiram', '', [stroption, stroption1, stroption2, stroption3, stroption4]) + descr = OptionDescription('tiram', '', [subdescr, stroption, stroption1, stroption2, stroption3, stroption4]) return descr diff --git a/tiramisu/value.py b/tiramisu/value.py index 41a9d42..505d9df 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -537,7 +537,7 @@ class Values(object): description, currpath, config, - od_setting_properties): + od_config_bag): settings = context.cfgimpl_get_settings() # for option in config.cfgimpl_get_children(self.config_bag): for option in description.impl_getchildren(config_bag, context): @@ -545,26 +545,23 @@ class Values(object): path = '.'.join(currpath + [name]) if option.impl_is_optiondescription(): - ori_setting_properties = config_bag.properties - config_bag.properties = od_setting_properties try: option_bag = OptionBag() option_bag.set_option(option, path, None, - config_bag) + od_config_bag) subconfig = config.get_subconfig(name, option_bag) except PropertiesOptionError as err: pass else: - config_bag.properties = ori_setting_properties for path in self._mandatory_warnings(context, config_bag, option, currpath + [name], subconfig, - od_setting_properties): + od_config_bag): yield path elif not option.impl_is_symlinkoption(): # don't verifying symlink @@ -610,6 +607,9 @@ class Values(object): config_bag = ConfigBag(context=config_bag.context) config_bag.properties = frozenset(setting_properties) config_bag.set_permissive() + od_config_bag = ConfigBag(context=config_bag.context) + od_config_bag.properties = frozenset(od_setting_properties) + od_config_bag.set_permissive() descr = context.cfgimpl_get_description() return self._mandatory_warnings(context, @@ -617,4 +617,4 @@ class Values(object): descr, [], context, - od_setting_properties) + od_config_bag)