coverage
This commit is contained in:
@ -83,8 +83,6 @@ class SubConfig(object):
|
||||
self = self.getattr(step,
|
||||
force_permissive=force_permissive,
|
||||
returns_raise=returns_raise)
|
||||
if isinstance(self, Exception):
|
||||
return self, None
|
||||
return self, path[-1]
|
||||
|
||||
#def __hash__(self):
|
||||
@ -272,14 +270,11 @@ class SubConfig(object):
|
||||
homeconfig, name = self.cfgimpl_get_home_by_path(
|
||||
name, force_permissive=force_permissive,
|
||||
returns_raise=returns_raise)
|
||||
if isinstance(homeconfig, Exception):
|
||||
cfg = homeconfig
|
||||
else:
|
||||
cfg = homeconfig.getattr(name, force_permissive=force_permissive,
|
||||
validate=validate,
|
||||
_setting_properties=_setting_properties,
|
||||
_self_properties=_self_properties,
|
||||
index=index, returns_raise=returns_raise)
|
||||
cfg = homeconfig.getattr(name, force_permissive=force_permissive,
|
||||
validate=validate,
|
||||
_setting_properties=_setting_properties,
|
||||
_self_properties=_self_properties,
|
||||
index=index, returns_raise=returns_raise)
|
||||
else:
|
||||
context = self._cfgimpl_get_context()
|
||||
option = self.cfgimpl_get_description().__getattr__(name,
|
||||
|
@ -473,7 +473,7 @@ class Option(OnlyOption):
|
||||
if warnings_only:
|
||||
if isinstance(err, ValueError):
|
||||
msg = _('attention, "{0}" could be an invalid {1} for "{2}", {3}').format(
|
||||
value, self._display_name, self.impl_get_display_name(), err)
|
||||
value, self._display_name, current_opt.impl_get_display_name(), err)
|
||||
else:
|
||||
msg = '{}'.format(err)
|
||||
warnings.warn_explicit(ValueWarning(msg, self),
|
||||
@ -614,8 +614,8 @@ class Option(OnlyOption):
|
||||
for idx, val in enumerate(value):
|
||||
if isinstance(val, list):
|
||||
return ValueError(_('invalid value "{}" for "{}" '
|
||||
'which must not be a list'.format(val,
|
||||
self.impl_get_display_name())))
|
||||
'which must not be a list').format(val,
|
||||
self.impl_get_display_name()))
|
||||
err = do_validation(val, force_index, idx)
|
||||
if err:
|
||||
return err
|
||||
@ -803,15 +803,11 @@ class Option(OnlyOption):
|
||||
log.debug(_('_cons_not_equal: {} are not different').format(display_list(list(equal))))
|
||||
if is_current:
|
||||
equal.remove('"' + current_opt.impl_get_display_name() + '"')
|
||||
if len(equal) == 0:
|
||||
msg = _('this value is already present')
|
||||
return ValueError(msg)
|
||||
if warnings_only:
|
||||
msg = _('should be different from the value of {}')
|
||||
else:
|
||||
if warnings_only:
|
||||
msg = _('should be different from the value of {}')
|
||||
else:
|
||||
msg = _('must be different from the value of {}')
|
||||
return ValueError(msg.format(display_list(list(equal))))
|
||||
msg = _('must be different from the value of {}')
|
||||
return ValueError(msg.format(display_list(list(equal))))
|
||||
else:
|
||||
if warnings_only:
|
||||
msg = _('value for {} should be different')
|
||||
@ -1005,16 +1001,6 @@ class SymLinkOption(OnlyOption):
|
||||
def impl_is_readonly(self):
|
||||
return True
|
||||
|
||||
def impl_getproperties(self):
|
||||
return self._impl_getopt()._properties
|
||||
|
||||
def impl_get_callback(self):
|
||||
return self._impl_getopt().impl_get_callback()
|
||||
|
||||
def impl_has_callback(self):
|
||||
"to know if a callback has been defined or not"
|
||||
return self._impl_getopt().impl_has_callback()
|
||||
|
||||
def impl_is_multi(self):
|
||||
return self._impl_getopt().impl_is_multi()
|
||||
|
||||
@ -1034,10 +1020,7 @@ class DynSymLinkOption(object):
|
||||
self._opt = opt
|
||||
|
||||
def __getattr__(self, name, context=undefined):
|
||||
if name in ('_opt', '_readonly', 'impl_getpath', '_name', '_state_opt'):
|
||||
return object.__getattr__(self, name)
|
||||
else:
|
||||
return getattr(self._impl_getopt(), name)
|
||||
return getattr(self._impl_getopt(), name)
|
||||
|
||||
def impl_getname(self):
|
||||
return self._name
|
||||
|
@ -396,7 +396,7 @@ class NetmaskOption(Option):
|
||||
def __cons_netmask(self, opts, val_netmask, val_ipnetwork, make_net,
|
||||
warnings_only):
|
||||
if len(opts) != 2:
|
||||
raise ConfigError(_('invalid len for opts')) # pragma: optional cover
|
||||
return ConfigError(_('invalid len for opts')) # pragma: optional cover
|
||||
msg = None
|
||||
try:
|
||||
ip = IP('{0}/{1}'.format(val_ipnetwork, val_netmask),
|
||||
|
Reference in New Issue
Block a user