forked from FairRootGroup/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
package: make possible_dependencies consider deptypes
- `PackageBase.possible_dependencies` now: - accepts a deptype param that controls dependency types traversed - returns a dict mapping possible depnames to their immediate possible dependencies (this lets you build a graph easily) - Add tests for PackageBaes
- Loading branch information
Showing
3 changed files
with
93 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other | ||
# Spack Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
"""Test class methods on Package objects. | ||
This doesn't include methods on package *instances* (like do_install(), | ||
etc.). Only methods like ``possible_dependencies()`` that deal with the | ||
static DSL metadata for packages. | ||
""" | ||
|
||
import spack.repo | ||
|
||
|
||
def test_possible_dependencies(mock_packages): | ||
mpileaks = spack.repo.get('mpileaks') | ||
mpi_names = [spec.name for spec in spack.repo.path.providers_for('mpi')] | ||
|
||
assert mpileaks.possible_dependencies() == { | ||
'callpath': set(['dyninst'] + mpi_names), | ||
'dyninst': set(['libdwarf', 'libelf']), | ||
'fake': set(), | ||
'libdwarf': set(['libelf']), | ||
'libelf': set(), | ||
'mpich': set(), | ||
'mpich2': set(), | ||
'mpileaks': set(['callpath'] + mpi_names), | ||
'multi-provider-mpi': set(), | ||
'zmpi': set(['fake']), | ||
} | ||
|
||
|
||
def test_possible_dependencies_with_deptypes(mock_packages): | ||
dtbuild1 = spack.repo.get('dtbuild1') | ||
|
||
assert dtbuild1.possible_dependencies(deptype=('link', 'run')) == { | ||
'dtbuild1': set(['dtrun2', 'dtlink2']), | ||
'dtlink2': set(), | ||
'dtrun2': set(), | ||
} | ||
|
||
assert dtbuild1.possible_dependencies(deptype=('build')) == { | ||
'dtbuild1': set(['dtbuild2', 'dtlink2']), | ||
'dtbuild2': set(), | ||
'dtlink2': set(), | ||
} | ||
|
||
assert dtbuild1.possible_dependencies(deptype=('link')) == { | ||
'dtbuild1': set(['dtlink2']), | ||
'dtlink2': set(), | ||
} |