Skip to content

Commit a7d0e0b

Browse files
committed
fix(from_deps): use appropriate dependency name when unique-kinds is true
1 parent ac4a5c3 commit a7d0e0b

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/taskgraph/transforms/from_deps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def from_deps(config, tasks):
241241
)
242242
fetches_from_dep.append(entry)
243243

244-
task_fetches[dep_task.label] = fetches_from_dep
244+
key = dep_task.kind if unique_kinds else dep_task.label
245+
task_fetches[key] = fetches_from_dep
245246

246247
yield new_task

test/test_transforms_from_deps.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ def assert_group_by_all_with_fetch(deps, tasks):
187187
}
188188

189189

190+
def assert_unique_kinds_with_fetch(deps, tasks):
191+
handle_exception(tasks)
192+
assert tasks[0]["fetches"] == {"foo": [{"artifact": "foo.txt"}]}
193+
194+
190195
@pytest.mark.parametrize(
191196
"task, kind_config, deps",
192197
(
@@ -423,6 +428,25 @@ def assert_group_by_all_with_fetch(deps, tasks):
423428
},
424429
id="group_by_all_with_fetch",
425430
),
431+
pytest.param(
432+
# task
433+
{
434+
"from-deps": {
435+
"kinds": ["foo"],
436+
"unique-kinds": True,
437+
"fetches": {
438+
"foo": [
439+
{"artifact": "foo.txt"},
440+
],
441+
},
442+
},
443+
},
444+
# kind config
445+
None,
446+
# deps
447+
None,
448+
id="unique_kinds_with_fetch",
449+
),
426450
),
427451
)
428452
def test_transforms(

0 commit comments

Comments
 (0)