regression: permissive for option is apply every time, not only when global permissive is set
This commit is contained in:
parent
40ecddf242
commit
9d92ab84d7
|
@ -120,7 +120,7 @@ def test_permissive_option():
|
|||
config.u1
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert props == ['disabled']
|
||||
assert props == []
|
||||
props = []
|
||||
try:
|
||||
config.u2
|
||||
|
@ -143,7 +143,7 @@ def test_permissive_option():
|
|||
config.u1
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert props == ['disabled']
|
||||
assert props == []
|
||||
props = []
|
||||
try:
|
||||
config.u2
|
||||
|
@ -182,20 +182,12 @@ def test_permissive_option_frozen():
|
|||
setting = config.cfgimpl_get_settings()
|
||||
config.read_write()
|
||||
setting.setpermissive(('frozen', 'disabled'), u1)
|
||||
try:
|
||||
config.u1 = 1
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == set(['frozen', 'disabled'])
|
||||
setting.append('permissive')
|
||||
config.u1 = 1
|
||||
assert config.u1 == 1
|
||||
setting.append('permissive')
|
||||
assert config.u1 == 1
|
||||
setting.remove('permissive')
|
||||
try:
|
||||
config.u1 = 1
|
||||
except PropertiesOptionError as err:
|
||||
props = err.proptype
|
||||
assert set(props) == set(['frozen', 'disabled'])
|
||||
assert config.u1 == 1
|
||||
|
||||
|
||||
def test_invalid_option_permissive():
|
||||
|
|
|
@ -248,6 +248,8 @@ class Undefined():
|
|||
|
||||
|
||||
undefined = Undefined()
|
||||
|
||||
|
||||
# ____________________________________________________________
|
||||
class Property(object):
|
||||
"a property is responsible of the option's value access rules"
|
||||
|
@ -283,6 +285,7 @@ class Property(object):
|
|||
self._properties.remove(propname)
|
||||
self._setting._setproperties(self._properties, self._opt,
|
||||
self._path)
|
||||
|
||||
def extend(self, propnames):
|
||||
"""Extends properties to the existing properties
|
||||
|
||||
|
@ -435,8 +438,9 @@ class Settings(object):
|
|||
properties = copy(self._getproperties(opt_or_descr, path))
|
||||
self_properties = copy(self._getproperties())
|
||||
# remove opt permissive
|
||||
if force_permissive is True or 'permissive' in self_properties:
|
||||
properties -= self._p_.getpermissive(path)
|
||||
# permissive affect option's permission with or without permissive
|
||||
# global property
|
||||
properties -= self._p_.getpermissive(path)
|
||||
# remove global permissive if need
|
||||
if force_permissive is True or 'permissive' in self_properties:
|
||||
properties -= self._p_.getpermissive()
|
||||
|
|
Loading…
Reference in New Issue