don't check 'mandatory' setting for symlink

This commit is contained in:
Emmanuel Garette 2016-03-16 22:33:28 +01:00
parent 777542844f
commit cb89c74201
2 changed files with 8 additions and 12 deletions

View File

@ -485,10 +485,10 @@ def test_mandatory_warnings_symlink():
setting = config.cfgimpl_get_settings()
config.read_write()
config.str
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str', 'str1', 'unicode2', 'str3']
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str', 'str1', 'str3']
setting[descr.str].append('frozen')
config.read_only()
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str', 'str1', 'unicode2', 'str3']
assert list(config.cfgimpl_get_values().mandatory_warnings()) == ['str', 'str1', 'str3']
def test_mandatory_warnings_validate():
@ -496,10 +496,10 @@ def test_mandatory_warnings_validate():
config = Config(descr)
config.str = ''
raises(ValueError, "list(config.cfgimpl_get_values().mandatory_warnings())")
assert list(config.cfgimpl_get_values().mandatory_warnings(validate=False)) == ['str', 'str1', 'unicode2', 'str3', 'unicode1', 'int1']
assert list(config.cfgimpl_get_values().mandatory_warnings(validate=False)) == ['str', 'str1', 'str3', 'unicode1', 'int1']
config.str = 'test'
raises(ValueError, "list(config.cfgimpl_get_values().mandatory_warnings())")
assert list(config.cfgimpl_get_values().mandatory_warnings(validate=False)) == ['str1', 'unicode2', 'str3']
assert list(config.cfgimpl_get_values().mandatory_warnings(validate=False)) == ['str1', 'str3']
def test_mandatory_warnings_validate_empty():
@ -508,7 +508,7 @@ def test_mandatory_warnings_validate_empty():
config.str = ''
config.read_only()
raises(ConfigError, "list(config.cfgimpl_get_values().mandatory_warnings())")
assert list(config.cfgimpl_get_values().mandatory_warnings(validate=False)) == ['str', 'str1', 'unicode2', 'str3', 'unicode1']
assert list(config.cfgimpl_get_values().mandatory_warnings(validate=False)) == ['str', 'str1', 'str3', 'unicode1']
def test_mandatory_warnings_requires():

View File

@ -610,16 +610,12 @@ class Values(object):
else:
if isinstance(opt, SymLinkOption) and \
not isinstance(opt, DynSymLinkOption):
true_opt = opt._impl_getopt()
true_path = descr.impl_get_path_by_opt(true_opt)
else:
true_opt = opt
true_path = path
self_properties = settings._getproperties(true_opt, true_path,
continue
self_properties = settings._getproperties(opt, path,
read_write=False,
setting_properties=setting_properties)
if 'mandatory' in self_properties:
err = self._get_cached_value(true_opt, path=true_path,
err = self._get_cached_value(opt, path=path,
trusted_cached_properties=False,
force_permissive=force_permissive,
setting_properties=setting_properties,