Fix typos when forwarding arguments to traverse_edges (#29261)

A few calls use `deptypes=...` instead of `deptype=...`
This commit is contained in:
Massimiliano Culpo 2022-03-02 08:43:26 +01:00 committed by Harmen Stoppels
parent 76488eacad
commit b772571c32
4 changed files with 11 additions and 4 deletions

View File

@ -685,7 +685,7 @@ def find_spec(spec, condition, default=None):
visited.add(id(relative))
# Then search all other relatives in the DAG *except* spec
for relative in spec.root.traverse(deptypes=all):
for relative in spec.root.traverse(deptype='all'):
if relative is spec:
continue
if id(relative) in visited:

View File

@ -1182,7 +1182,7 @@ def extendee_spec(self):
name = next(iter(self.extendees))
# If the extendee is in the spec's deps already, return that.
for dep in self.spec.traverse(deptypes=('link', 'run')):
for dep in self.spec.traverse(deptype=('link', 'run')):
if name == dep.name:
return dep

View File

@ -4259,7 +4259,7 @@ def tree(self, **kwargs):
out = ""
for d, dep_spec in self.traverse_edges(
order='pre', cover=cover, depth=True, deptypes=deptypes):
order='pre', cover=cover, depth=True, deptype=deptypes):
node = dep_spec.spec
if prefix is not None:

View File

@ -974,7 +974,6 @@ def test_canonical_deptype(self):
canonical_deptype(('foo',))
def test_invalid_literal_spec(self):
# Can't give type 'build' to a top-level spec
with pytest.raises(spack.spec.SpecParseError):
Spec.from_literal({'foo:build': None})
@ -982,3 +981,11 @@ def test_invalid_literal_spec(self):
# Can't use more than one ':' separator
with pytest.raises(KeyError):
Spec.from_literal({'foo': {'bar:build:link': None}})
def test_spec_tree_respect_deptypes(self):
# Version-test-root uses version-test-pkg as a build dependency
s = Spec('version-test-root').concretized()
out = s.tree(deptypes='all')
assert 'version-test-pkg' in out
out = s.tree(deptypes=('link', 'run'))
assert 'version-test-pkg' not in out