提交 3fade65f 编写于 作者: L Lukáš Doktor

avocado..tree: Overwrite multiplex only when explicitely asked for

Originally we used multiplex = True and False. This patch adds None and
the value is not updated during merge when the new node's multiplex is
None.

Currently this means that once node is set as multiplex, there is no way
to undo this. We might consider creating !nomux flag in the future to
force multiplex = False, but this is currently not needed.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 305d390b
......@@ -89,7 +89,7 @@ class TreeNode(object):
self._environment = None
self.environment_origin = {}
self.ctrl = []
self.multiplex = False
self.multiplex = None
for child in children:
self.add_child(child)
......@@ -159,7 +159,10 @@ class TreeNode(object):
remove.append(key)
for key in remove:
self.value.pop(key, None)
self.multiplex = other.multiplex
if other.multiplex is True:
self.multiplex = True
elif other.multiplex is False:
self.multiplex = False
self.value.update(other.value)
for child in other.children:
self.add_child(child)
......
......@@ -171,20 +171,20 @@ class TestTree(unittest.TestCase):
self.assertEqual({'new_value': 'something'},
oldroot.children[3].children[0].children[0].value)
# multiplex root (always True)
self.assertEqual(tree2.multiplex, False)
self.assertEqual(tree2.multiplex, None)
# multiplex /virt/
self.assertEqual(tree2.children[0].multiplex, False)
self.assertEqual(tree2.children[0].multiplex, None)
# multiplex /virt/hw
self.assertEqual(tree2.children[0].children[0].multiplex, False)
self.assertEqual(tree2.children[0].children[0].multiplex, None)
# multiplex /virt/distro
self.assertEqual(tree2.children[0].children[1].multiplex, True)
# multiplex /virt/env
self.assertEqual(tree2.children[0].children[2].multiplex, True)
# multiplex /virt/absolutly
self.assertEqual(tree2.children[0].children[3].multiplex, False)
self.assertEqual(tree2.children[0].children[3].multiplex, None)
# multiplex /virt/distro/fedora
self.assertEqual(tree2.children[0].children[1].children[0].multiplex,
False)
None)
class TestPathParent(unittest.TestCase):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册