do not raise un __new__
This commit is contained in:
parent
1cda79154e
commit
69919535f6
3 changed files with 15 additions and 22 deletions
|
@ -5,13 +5,13 @@ import pytest
|
||||||
import warnings
|
import warnings
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from py.test import raises
|
from py.test import raises
|
||||||
|
from collections import OrderedDict
|
||||||
from .autopath import do_autopath
|
from .autopath import do_autopath
|
||||||
do_autopath()
|
do_autopath()
|
||||||
from tiramisu import Config, MetaConfig, \
|
from tiramisu import Config, MetaConfig, \
|
||||||
StrOption, SymLinkOption, OptionDescription, MasterSlaves, DynOptionDescription, \
|
StrOption, SymLinkOption, OptionDescription, MasterSlaves, DynOptionDescription, \
|
||||||
submulti, undefined, owners, Params, ParamOption
|
submulti, undefined, owners, Params, ParamOption
|
||||||
from tiramisu.error import PropertiesOptionError, APIError, ConfigError, SlaveError
|
from tiramisu.error import PropertiesOptionError, APIError, ConfigError, SlaveError
|
||||||
from collections import OrderedDict
|
|
||||||
ICON = u'\u2937'
|
ICON = u'\u2937'
|
||||||
|
|
||||||
OPTIONS_TYPE = {'str': {'type': str,
|
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]])
|
cfg.config(conf).forcepermissive.option(pathwrite).value.set([first_value[0]])
|
||||||
else:
|
else:
|
||||||
raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set([first_value[0]])")
|
raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set([first_value[0]])")
|
||||||
raises(PropertiesOptionError,
|
raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathwrite).value.set([first_value[0]])")
|
||||||
"cfg.config(conf).forcepermissive.option(pathwrite).value.set([first_value[0]])")
|
|
||||||
if len(first_value) > 1:
|
if len(first_value) > 1:
|
||||||
raises(APIError, "cfg.config(conf).unrestraint.option(pathwrite).value.set(first_value[1])")
|
raises(APIError, "cfg.config(conf).unrestraint.option(pathwrite).value.set(first_value[1])")
|
||||||
elif isslave:
|
elif isslave:
|
||||||
|
@ -161,10 +160,8 @@ def _set_value(cfg, pathwrite, conf, **kwargs):
|
||||||
cfg.config(conf).forcepermissive.option(pathwrite, 1).value.set(second_value)
|
cfg.config(conf).forcepermissive.option(pathwrite, 1).value.set(second_value)
|
||||||
else:
|
else:
|
||||||
raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite, 1).value.set(second_value)")
|
raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite, 1).value.set(second_value)")
|
||||||
raises(PropertiesOptionError,
|
raises(PropertiesOptionError, "cfg.config(conf).forcepermissive.option(pathwrite, 1).value.set(second_value)")
|
||||||
"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(APIError,
|
|
||||||
"cfg.config(conf).unrestraint.option(pathwrite).value.set([second_value, second_value])")
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
||||||
|
@ -1751,7 +1748,6 @@ def test_options(paths):
|
||||||
# continue
|
# continue
|
||||||
# for default in (True,):
|
# for default in (True,):
|
||||||
# for multi in (submulti,):
|
# 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:
|
if multi is submulti and default:
|
||||||
continue
|
continue
|
||||||
if multi is submulti and consistency:
|
if multi is submulti and consistency:
|
||||||
|
|
|
@ -524,14 +524,9 @@ class TiramisuOptionValue(CommonTiramisuOption):
|
||||||
subconfig,
|
subconfig,
|
||||||
option_bag):
|
option_bag):
|
||||||
if subconfig is not None:
|
if subconfig is not None:
|
||||||
cls._name = name
|
option = subconfig.cfgimpl_get_description().impl_getchild(name,
|
||||||
cls._subconfig = subconfig
|
option_bag.config_bag,
|
||||||
cls._option_bag = option_bag
|
subconfig.cfgimpl_get_path())
|
||||||
cls._get_option(cls)
|
|
||||||
option = option_bag.option
|
|
||||||
del cls._name
|
|
||||||
del cls._subconfig
|
|
||||||
del cls._option_bag
|
|
||||||
else:
|
else:
|
||||||
option = None
|
option = None
|
||||||
types = [CommonTiramisuOption]
|
types = [CommonTiramisuOption]
|
||||||
|
|
|
@ -693,7 +693,9 @@ class Settings(object):
|
||||||
option_properties,
|
option_properties,
|
||||||
config_properties,
|
config_properties,
|
||||||
config_permissives):
|
config_permissives):
|
||||||
properties = option_properties & config_properties - {'frozen', 'mandatory', 'empty'}
|
properties = option_properties & config_properties - {'frozen',
|
||||||
|
'mandatory',
|
||||||
|
'empty'}
|
||||||
# remove global permissive properties
|
# remove global permissive properties
|
||||||
if properties and ('permissive' in config_properties):
|
if properties and ('permissive' in config_properties):
|
||||||
properties -= config_permissives
|
properties -= config_permissives
|
||||||
|
@ -713,8 +715,8 @@ class Settings(object):
|
||||||
if not config_bag.properties:
|
if not config_bag.properties:
|
||||||
return
|
return
|
||||||
properties = self.calc_raises_properties(option_bag.properties,
|
properties = self.calc_raises_properties(option_bag.properties,
|
||||||
option_bag.config_bag.properties,
|
config_bag.properties,
|
||||||
option_bag.config_bag.permissives)
|
config_bag.permissives)
|
||||||
if properties != frozenset():
|
if properties != frozenset():
|
||||||
raise PropertiesOptionError(option_bag,
|
raise PropertiesOptionError(option_bag,
|
||||||
properties,
|
properties,
|
||||||
|
|
Loading…
Reference in a new issue