diff --git a/test/auto/test_auto.py b/test/auto/test_auto.py index 7b485f9..7e8da5e 100644 --- a/test/auto/test_auto.py +++ b/test/auto/test_auto.py @@ -5,18 +5,18 @@ import pytest import warnings from copy import copy from py.test import raises +from collections import OrderedDict from .autopath import do_autopath do_autopath() from tiramisu import Config, MetaConfig, \ StrOption, SymLinkOption, OptionDescription, MasterSlaves, DynOptionDescription, \ submulti, undefined, owners, Params, ParamOption from tiramisu.error import PropertiesOptionError, APIError, ConfigError, SlaveError -from collections import OrderedDict ICON = u'\u2937' OPTIONS_TYPE = {'str': {'type': str, 'option': StrOption} - } + } PROPERTIES = ['hidden', 'disabled', 'mandatory'] PROPERTIES_LIST = ['prop1', 'prop2'] @@ -145,8 +145,7 @@ def _set_value(cfg, pathwrite, conf, **kwargs): cfg.config(conf).forcepermissive.option(pathwrite).value.set([first_value[0]]) else: raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set([first_value[0]])") - raises(PropertiesOptionError, - "cfg.config(conf).forcepermissive.option(pathwrite).value.set([first_value[0]])") + raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathwrite).value.set([first_value[0]])") if len(first_value) > 1: raises(APIError, "cfg.config(conf).unrestraint.option(pathwrite).value.set(first_value[1])") elif isslave: @@ -161,10 +160,8 @@ def _set_value(cfg, pathwrite, conf, **kwargs): cfg.config(conf).forcepermissive.option(pathwrite, 1).value.set(second_value) else: raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite, 1).value.set(second_value)") - raises(PropertiesOptionError, - "cfg.config(conf).forcepermissive.option(pathwrite, 1).value.set(second_value)") - raises(APIError, - "cfg.config(conf).unrestraint.option(pathwrite).value.set([second_value, second_value])") + raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathwrite, 1).value.set(second_value)") + raises(APIError, "cfg.config(conf).unrestraint.option(pathwrite).value.set([second_value, second_value])") else: if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): @@ -1751,7 +1748,6 @@ def test_options(paths): # continue # for default in (True,): # for multi in (submulti,): - meta, callback, consistency, require, default_multi, symlink, default, multi = (True, False, True, False, True, True, True, True) if multi is submulti and default: continue if multi is submulti and consistency: diff --git a/tiramisu/api.py b/tiramisu/api.py index c1ac7a0..2aebdbe 100644 --- a/tiramisu/api.py +++ b/tiramisu/api.py @@ -524,14 +524,9 @@ class TiramisuOptionValue(CommonTiramisuOption): subconfig, option_bag): if subconfig is not None: - cls._name = name - cls._subconfig = subconfig - cls._option_bag = option_bag - cls._get_option(cls) - option = option_bag.option - del cls._name - del cls._subconfig - del cls._option_bag + option = subconfig.cfgimpl_get_description().impl_getchild(name, + option_bag.config_bag, + subconfig.cfgimpl_get_path()) else: option = None types = [CommonTiramisuOption] diff --git a/tiramisu/setting.py b/tiramisu/setting.py index 94f6db7..65c448e 100644 --- a/tiramisu/setting.py +++ b/tiramisu/setting.py @@ -326,7 +326,7 @@ class Undefined(object): undefined = Undefined() -#____________________________________________________________ +# ____________________________________________________________ class Settings(object): "``config.Config()``'s configuration options settings" __slots__ = ('_p_', @@ -349,7 +349,7 @@ class Settings(object): self._p_ = properties self._pp_ = permissives - #____________________________________________________________ + # ____________________________________________________________ # get properties and permissive methods def get_context_properties(self): @@ -693,7 +693,9 @@ class Settings(object): option_properties, config_properties, config_permissives): - properties = option_properties & config_properties - {'frozen', 'mandatory', 'empty'} + properties = option_properties & config_properties - {'frozen', + 'mandatory', + 'empty'} # remove global permissive properties if properties and ('permissive' in config_properties): properties -= config_permissives @@ -713,8 +715,8 @@ class Settings(object): if not config_bag.properties: return properties = self.calc_raises_properties(option_bag.properties, - option_bag.config_bag.properties, - option_bag.config_bag.permissives) + config_bag.properties, + config_bag.permissives) if properties != frozenset(): raise PropertiesOptionError(option_bag, properties,