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 GitHub
parent a43e3f3ffb
commit 8d118104c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 4 deletions

View File

@ -701,7 +701,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

@ -1189,7 +1189,7 @@ def extendee_spec(self):
deps = []
# 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 dep.name in self.extendees:
deps.append(dep)

View File

@ -4272,7 +4272,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