propertyerror are transitive in consistency, now it's possible to set non-transitive consistency
This commit is contained in:
@ -5,7 +5,7 @@ from tiramisu.setting import owners, groups
|
||||
from tiramisu.config import Config
|
||||
from tiramisu.option import IPOption, NetworkOption, NetmaskOption, IntOption,\
|
||||
BroadcastOption, SymLinkOption, OptionDescription
|
||||
from tiramisu.error import ConfigError, ValueWarning
|
||||
from tiramisu.error import ConfigError, ValueWarning, PropertiesOptionError
|
||||
import warnings
|
||||
|
||||
|
||||
@ -27,6 +27,13 @@ def test_consistency_not_exists():
|
||||
raises(ConfigError, "a.impl_add_consistency('not_exists', b)")
|
||||
|
||||
|
||||
def test_consistency_unknown_params():
|
||||
a = IntOption('a', '')
|
||||
b = IntOption('b', '')
|
||||
od = OptionDescription('od', '', [a, b])
|
||||
raises(ValueError, "a.impl_add_consistency('not_equal', b, unknown=False)")
|
||||
|
||||
|
||||
def test_consistency_warnings_only():
|
||||
a = IntOption('a', '')
|
||||
b = IntOption('b', '')
|
||||
@ -392,6 +399,26 @@ def test_consistency_permissive():
|
||||
c.a = 1
|
||||
|
||||
|
||||
def test_consistency_disabled():
|
||||
a = IntOption('a', '')
|
||||
b = IntOption('b', '', properties=('disabled',))
|
||||
od = OptionDescription('od', '', [a, b])
|
||||
a.impl_add_consistency('not_equal', b)
|
||||
c = Config(od)
|
||||
c.read_write()
|
||||
raises(PropertiesOptionError, "c.a = 1")
|
||||
|
||||
|
||||
def test_consistency_disabled_transitive():
|
||||
a = IntOption('a', '')
|
||||
b = IntOption('b', '', properties=('disabled',))
|
||||
od = OptionDescription('od', '', [a, b])
|
||||
a.impl_add_consistency('not_equal', b, transitive=False)
|
||||
c = Config(od)
|
||||
c.read_write()
|
||||
c.a = 1
|
||||
|
||||
|
||||
def return_val(*args, **kwargs):
|
||||
return '192.168.1.1'
|
||||
|
||||
|
Reference in New Issue
Block a user