Beispiel #1
0
 def test_set_prior_waiting_on_itself(self):
     node = DirectoryNode("path_part", None)
     node.lock()
     node.waiting_nodes.append("another task")
     node.add_waiting_node(node)
     assert node in node.waiting_nodes
     assert node is node.waiting_nodes[1]
     assert node is node.waiting_for_node
     node.set_prior()
     assert node in node.waiting_nodes
     assert node is node.waiting_nodes[0]
     assert node is node.waiting_for_node
Beispiel #2
0
 def test_set_prior_waiting_on_another_node(self):
     node1 = DirectoryNode("path_part1", None)
     node2 = DirectoryNode("path_part2", node1)
     node2.lock(node1)
     node1.waiting_nodes.append("another task")
     node2.add_waiting_node(node2)
     assert node2 in node1.waiting_nodes
     assert node2 is node1.waiting_nodes[1]
     assert node1 is node2.waiting_for_node
     node2.set_prior()
     assert node2 in node1.waiting_nodes
     assert node2 is node1.waiting_nodes[0]
     assert node1 is node2.waiting_for_node
Beispiel #3
0
 def test_set_prior_no_waiting(self):
     node = DirectoryNode("path_part", None)
     node.set_prior()