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)
def test_conflicting_spec_constraints(self): mpileaks = Spec('mpileaks ^mpich ^callpath ^dyninst ^libelf ^libdwarf') # Normalize then add conflicting constraints to the DAG (this is an # extremely unlikely scenario, but we test for it anyway) mpileaks.normalize() mpileaks.edges_to_dependencies( name='mpich')[0].spec = Spec('[email protected]') mpileaks.edges_to_dependencies( name='callpath')[0].spec.edges_to_dependencies( name='mpich')[0].spec = Spec('[email protected]') with pytest.raises(spack.spec.InconsistentSpecError): mpileaks.flat_dependencies(copy=False)