Example #1
0
def test_addition_of_different_deptypes_in_multiple_calls(mock_packages, config):
    # Construct the following spec:
    #
    #  [email protected]
    #    | build,link,run
    #  [email protected]
    #
    # with three calls and check we always have a single edge
    root = Spec('[email protected]').concretized()
    bootstrap = Spec('[email protected]').concretized()

    for current_deptype in ('build', 'link', 'run'):
        root.add_dependency_edge(bootstrap, deptype=current_deptype)

        # Check edges in dependencies
        assert len(root.edges_to_dependencies()) == 1
        forward_edge = root.edges_to_dependencies(deptype=current_deptype)[0]
        assert current_deptype in forward_edge.deptypes
        assert id(forward_edge.parent) == id(root)
        assert id(forward_edge.spec) == id(bootstrap)

        # Check edges from dependents
        assert len(bootstrap.edges_from_dependents()) == 1
        backward_edge = bootstrap.edges_from_dependents(deptype=current_deptype)[0]
        assert current_deptype in backward_edge.deptypes
        assert id(backward_edge.parent) == id(root)
        assert id(backward_edge.spec) == id(bootstrap)