fix: can unrestraint a already unrestraint config

This commit is contained in:
egarette@silique.fr 2025-10-06 21:37:46 +02:00
parent d44a5ebe32
commit ecbd17915b
2 changed files with 12 additions and 1 deletions

View file

@ -22,7 +22,16 @@ def test_forcepermissive_and_unrestraint(config_type):
cfg_ori.property.read_write()
cfg = get_config(cfg_ori, config_type)
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):

View file

@ -1931,6 +1931,8 @@ class TiramisuAPI(TiramisuHelp):
def __getattr__(self, subfunc: str) -> Any:
if subfunc in ["forcepermissive", "unrestraint", "nowarnings"]:
if subfunc == "unrestraint" and self._config_bag.is_unrestraint:
return self
if self._orig_config_bags:
msg = _(
"do not use unrestraint, nowarnings or forcepermissive together"