if consistency with multiple option return if transitive
authorEmmanuel Garette <egarette@cadoles.com>
Mon, 1 Dec 2014 22:02:55 +0000 (23:02 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Mon, 1 Dec 2014 22:02:55 +0000 (23:02 +0100)
ChangeLog
test/test_option_consistency.py
tiramisu/option/baseoption.py

index 65824bc..7614f2f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 Mon Dec  1 22:58:13 2014 +0200 Emmanuel Garette <egarette@cadoles.com>
        * propertyerror are transitive in consistency, now it's possible to set
        non-transitive consistency
+       * if consistency with multiple option return if transitive
 
 Sun Oct 26 08:50:38 2014 +0200 Emmanuel Garette <egarette@cadoles.com>
        * if option is frozen with force_default_on_freeze property, owner
index cca1909..ba3549c 100644 (file)
@@ -419,6 +419,25 @@ def test_consistency_disabled_transitive():
     c.a = 1
 
 
+def test_consistency_disabled_transitive_2():
+    a = IPOption('a', '')
+    b = IPOption('b', '')
+    c = NetworkOption('c', '', default='192.168.1.0')
+    d = NetmaskOption('d', '', default='255.255.255.0', properties=('disabled',))
+    od = OptionDescription('od', '', [a, b, c, d])
+    a.impl_add_consistency('not_equal', b)
+    a.impl_add_consistency('in_network', c, d, transitive=False)
+    c = Config(od)
+    c.read_write()
+    c.a = '192.168.1.1'
+    raises(ValueError, "c.b = '192.168.1.1'")
+    c.a = '192.168.2.1'
+    #
+    c.a = '192.168.1.1'
+    c.cfgimpl_get_settings().remove('disabled')
+    raises(ValueError, "c.a = '192.168.2.1'")
+
+
 def return_val(*args, **kwargs):
     return '192.168.1.1'
 
index 8d08c80..04cd2a8 100644 (file)
@@ -469,7 +469,7 @@ class Option(OnlyOption):
                 if transitive:
                     raise err
                 else:
-                    pass
+                    return
         getattr(self, func)(all_cons_opts, all_cons_vals, warnings_only)
 
     def impl_validate(self, value, context=undefined, validate=True,