(self, linker: Linker, manifest: Manifest)
This method adds additional edges to the DAG. For a given non-test
        executable node, add an edge from an upstream test to the given node if
        the set of nodes the test depends on is a subset of the upstream nodes
        for the given node.
This method adds additional edges to the DAG. For a given non-test
        executable node, add an edge from an upstream test to the given node if
        the set of nodes the test depends on is a subset of the upstream nodes
        for the given node.
This method adds additional edges to the DAG . For a given non - test executable node add an edge from an upstream test to the given node if the set of nodes the test depends on is a subset of the upstream nodes for the given node .
def add_test_edges(self, linker: Linker, manifest: Manifest) -> None:
        """ This method adds additional edges to the DAG. For a given non-test
        executable node, add an edge from an upstream test to the given node if
        the set of nodes the test depends on is a subset of the upstream nodes
        for the given node. """

        # Given a graph:
        # model1 --> model2 --> model3
        #   |             |
        #   |            \/
        #  \/          test 2
        # test1
        #
        # Produce the following graph:
        # model1 --> model2 --> model3
        #   |       /\    |      /\ /\
        #   |       |    \/      |  |
        #  \/       |  test2 ----|  |
        # test1 ----|---------------|

        for node_id in linker.graph:
            # If node is executable (in manifest.nodes) and does _not_
            # represent a test, continue.
            if (
                node_id in manifest.nodes and
                manifest.nodes[node_id].resource_type != NodeType.Test
            ):
                # Get *everything* upstream of the node
                all_upstream_nodes = nx.traversal.bfs_tree(
                    linker.graph, node_id, reverse=True
                )
                # Get the set of upstream nodes not including the current node.
                upstream_nodes = set([
                    n for n in all_upstream_nodes if n != node_id
                ])

                # Get all tests that depend on any upstream nodes.
                upstream_tests = []
                for upstream_node in upstream_nodes:
                    upstream_tests += _get_tests_for_node(
                        manifest,
                        upstream_node
                    )

                for upstream_test in upstream_tests:
                    # Get the set of all nodes that the test depends on
                    # including the upstream_node itself. This is necessary
                    # because tests can depend on multiple nodes (ex:
                    # relationship tests). Test nodes do not distinguish
                    # between what node the test is "testing" and what
                    # node(s) it depends on.
                    test_depends_on = set(
                        manifest.nodes[upstream_test].depends_on_nodes
                    )

                    # If the set of nodes that an upstream test depends on
                    # is a subset of all upstream nodes of the current node,
                    # add an edge from the upstream test to the current node.
                    if (test_depends_on.issubset(upstream_nodes)):
                        linker.graph.add_edge(
                            upstream_test,
                            node_id
                        )
def add_test_edges ( self , linker : Linker , manifest : Manifest ) -> None : # Given a graph: # model1 --> model2 --> model3 #   |             | #   |            \/ #  \/          test 2 # test1 # # Produce the following graph: # model1 --> model2 --> model3 #   |       /\    |      /\ /\ #   |       |    \/      |  | #  \/       |  test2 ----|  | # test1 ----|---------------| for node_id in linker . graph : # If node is executable (in manifest.nodes) and does _not_ # represent a test, continue. if ( node_id in manifest . nodes and manifest . nodes [ node_id ] . resource_type != NodeType . Test ) : # Get *everything* upstream of the node all_upstream_nodes = nx . traversal . bfs_tree ( linker . graph , node_id , reverse = True ) # Get the set of upstream nodes not including the current node. upstream_nodes = set ( [ n for n in all_upstream_nodes if n != node_id ] ) # Get all tests that depend on any upstream nodes. upstream_tests = [ ] for upstream_node in upstream_nodes : upstream_tests += _get_tests_for_node ( manifest , upstream_node ) for upstream_test in upstream_tests : # Get the set of all nodes that the test depends on # including the upstream_node itself. This is necessary # because tests can depend on multiple nodes (ex: # relationship tests). Test nodes do not distinguish # between what node the test is "testing" and what # node(s) it depends on. test_depends_on = set ( manifest . nodes [ upstream_test ] . depends_on_nodes ) # If the set of nodes that an upstream test depends on # is a subset of all upstream nodes of the current node, # add an edge from the upstream test to the current node. if ( test_depends_on . issubset ( upstream_nodes ) ) : linker . graph . add_edge ( upstream_test , node_id )