def _add_nodes_to_bm(builder, src_files): bm = BuildManager() try: checksums_node = Node(builder, src_files) checksums_node2 = Node(builder, checksums_node) bm.add([checksums_node]) bm.self_test() bm.add([checksums_node2]) bm.self_test() except Exception: bm.close() raise return bm
def test_bm_deps(self): bm = BuildManager() value1 = SimpleEntity("http://aql.org/download1", name="target_url1") value2 = SimpleEntity("http://aql.org/download2", name="target_url2") value3 = SimpleEntity("http://aql.org/download3", name="target_url3") options = builtin_options() builder = CopyValueBuilder(options) node0 = Node(builder, value1) node1 = Node(builder, node0) node2 = Node(builder, node1) node3 = Node(builder, value2) node4 = Node(builder, value3) node5 = Node(builder, node4) node6 = Node(builder, node5) node6.depends([node0, node1]) bm.add([node0]) bm.self_test() self.assertEqual(len(bm), 1) bm.add([node1]) bm.self_test() self.assertEqual(len(bm), 2) bm.add([node2]) bm.self_test() self.assertEqual(len(bm), 3) bm.add([node3]) bm.self_test() self.assertEqual(len(bm), 4) bm.add([node4]) bm.self_test() self.assertEqual(len(bm), 5) bm.add([node5]) bm.self_test() self.assertEqual(len(bm), 6) bm.add([node6]) bm.self_test() self.assertEqual(len(bm), 7) node0.depends(node3) bm.depends(node0, [node3]) bm.self_test() node1.depends(node3) bm.depends(node1, [node3]) bm.self_test() node2.depends(node3) bm.depends(node2, [node3]) bm.self_test() node3.depends(node4) bm.depends(node3, [node4]) bm.self_test() node0.depends(node5) bm.depends(node0, [node5]) bm.self_test() node5.depends(node3) bm.depends(node5, [node3]) bm.self_test() def _cyclic_deps(src_node, dep_node): src_node.depends(dep_node) bm.depends(src_node, [dep_node]) self.assertRaises(ErrorNodeDependencyCyclic, _cyclic_deps, node4, node3)