Skip to content

Commit

Permalink
WIP: deptypes: add some notes to the test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
mathstuf committed Jan 19, 2016
1 parent b3e0d0f commit 772f60e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/spack/spack/test/concretize.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def test_concretize_with_provides_when(self):
def test_virtual_is_fully_expanded_for_callpath(self):
# force dependence on fake "zmpi" by asking for MPI 10.0
spec = Spec('callpath ^mpi@10.0')
# XXX(deptype): handle deptypes.
self.assertTrue('mpi' in spec.dependencies)
self.assertFalse('fake' in spec)

Expand All @@ -161,6 +162,7 @@ def test_virtual_is_fully_expanded_for_callpath(self):

def test_virtual_is_fully_expanded_for_mpileaks(self):
spec = Spec('mpileaks ^mpi@10.0')
# XXX(deptype): handle deptypes.
self.assertTrue('mpi' in spec.dependencies)
self.assertFalse('fake' in spec)

Expand Down
2 changes: 2 additions & 0 deletions lib/spack/spack/test/mock_packages_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def set_pkg_dep(self, pkg_name, spec):
self.saved_deps[pkg_name] = (pkg, pkg.dependencies.copy())

# Change dep spec
# XXX(deptype): handle deptypes.
pkg.dependencies[spec.name] = { Spec(pkg_name) : spec }


Expand All @@ -107,6 +108,7 @@ def cleanmock(self):
shutil.rmtree(self.temp_config, ignore_errors=True)
spack.config.clear_config_caches()

# XXX(deptype): handle deptypes.
# Restore dependency changes that happened during the test
for pkg_name, (pkg, deps) in self.saved_deps.items():
pkg.dependencies.clear()
Expand Down
3 changes: 3 additions & 0 deletions lib/spack/spack/test/spec_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def test_conflicting_spec_constraints(self):
# Normalize then add conflicting constraints to the DAG (this is an
# extremely unlikely scenario, but we test for it anyway)
mpileaks.normalize()
# XXX(deptype): handle deptypes.
mpileaks.dependencies['mpich'] = Spec('mpich@1.0')
mpileaks.dependencies['callpath'].dependencies['mpich'] = Spec('mpich@2.0')

Expand Down Expand Up @@ -197,10 +198,12 @@ def test_normalize_with_virtual_spec(self):
def check_links(self, spec_to_check):
for spec in spec_to_check.traverse():
for dependent in spec.dependents.values():
# XXX(deptype): handle deptypes.
self.assertTrue(
spec.name in dependent.dependencies,
"%s not in dependencies of %s" % (spec.name, dependent.name))

# XXX(deptype): handle deptypes.
for dependency in spec.dependencies.values():
self.assertTrue(
spec.name in dependency.dependents,
Expand Down
3 changes: 3 additions & 0 deletions lib/spack/spack/test/unit_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ def write_to(self, stream):

class MockSpec(object):
def __init__(self, name, version, hashStr=None):
# XXX(deptype): handle deptypes.
self.dependencies = {}
self.name = name
self.version = version
self.hash = hashStr if hashStr else hash((name, version))

def traverse(self, order=None):
# XXX(deptype): handle deptypes.
allDeps = itertools.chain.from_iterable(i.traverse() for i in
self.dependencies.itervalues())
return set(itertools.chain([self], allDeps))
Expand All @@ -64,6 +66,7 @@ def __init__(self, buildLogPath):

specX = MockSpec("X", "1.2.0")
specY = MockSpec("Y", "2.3.8")
# XXX(deptype): handle deptypes.
specX.dependencies['Y'] = specY
pkgX = MockPackage('logX')
pkgY = MockPackage('logY')
Expand Down

0 comments on commit 772f60e

Please sign in to comment.