fix: can unrestraint a already unrestraint config
This commit is contained in:
parent
d44a5ebe32
commit
ecbd17915b
2 changed files with 12 additions and 1 deletions
|
|
@ -22,7 +22,16 @@ def test_forcepermissive_and_unrestraint(config_type):
|
||||||
cfg_ori.property.read_write()
|
cfg_ori.property.read_write()
|
||||||
cfg = get_config(cfg_ori, config_type)
|
cfg = get_config(cfg_ori, config_type)
|
||||||
with pytest.raises(ConfigError):
|
with pytest.raises(ConfigError):
|
||||||
cfg_ori.forcepermissive.add('disabled')
|
cfg_ori.unrestraint.forcepermissive
|
||||||
|
|
||||||
|
|
||||||
|
def test_unrestraint_and_unrestraint(config_type):
|
||||||
|
od1 = make_description()
|
||||||
|
cfg_ori = Config(od1)
|
||||||
|
cfg_ori.property.read_write()
|
||||||
|
cfg_ori.property.read_write()
|
||||||
|
cfg = get_config(cfg_ori, config_type)
|
||||||
|
cfg_ori.unrestraint.unrestraint
|
||||||
|
|
||||||
|
|
||||||
def test_permissive(config_type):
|
def test_permissive(config_type):
|
||||||
|
|
|
||||||
|
|
@ -1931,6 +1931,8 @@ class TiramisuAPI(TiramisuHelp):
|
||||||
|
|
||||||
def __getattr__(self, subfunc: str) -> Any:
|
def __getattr__(self, subfunc: str) -> Any:
|
||||||
if subfunc in ["forcepermissive", "unrestraint", "nowarnings"]:
|
if subfunc in ["forcepermissive", "unrestraint", "nowarnings"]:
|
||||||
|
if subfunc == "unrestraint" and self._config_bag.is_unrestraint:
|
||||||
|
return self
|
||||||
if self._orig_config_bags:
|
if self._orig_config_bags:
|
||||||
msg = _(
|
msg = _(
|
||||||
"do not use unrestraint, nowarnings or forcepermissive together"
|
"do not use unrestraint, nowarnings or forcepermissive together"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue