do not raise un __new__

This commit is contained in:
Emmanuel Garette 2018-10-30 11:57:04 +01:00
parent 1cda79154e
commit 69919535f6
3 changed files with 15 additions and 22 deletions

View File

@ -5,13 +5,13 @@ 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,
@ -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:

View File

@ -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]

View File

@ -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,