def test_synthetic_construction_of_split_dependencies_from_same_package( mock_packages, config ): # Construct in a synthetic way (i.e. without using the solver) # the following spec: # # b # build / \ link,run # [email protected] [email protected] # # To demonstrate that a spec can now hold two direct # dependencies from the same package root = Spec('b').concretized() link_run_spec = Spec('[email protected]').concretized() build_spec = Spec('[email protected]').concretized() root.add_dependency_edge(link_run_spec, deptype='link') root.add_dependency_edge(link_run_spec, deptype='run') root.add_dependency_edge(build_spec, deptype='build') # Check dependencies from the perspective of root assert len(root.dependencies()) == 2 assert all(x.name == 'c' for x in root.dependencies()) assert '@2.0' in root.dependencies(name='c', deptype='build')[0] assert '@1.0' in root.dependencies(name='c', deptype=('link', 'run'))[0] # Check parent from the perspective of the dependencies assert len(build_spec.dependents()) == 1 assert len(link_run_spec.dependents()) == 1 assert build_spec.dependents() == link_run_spec.dependents() assert build_spec != link_run_spec