Skip to content

Commit 9a02bfa

Browse files
jrs65ljgray
authored andcommitted
test(pipeline): ensure multiple output pipeline tasks are supported
1 parent c7f8de8 commit 9a02bfa

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

caput/pipeline.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ def _setup_tasks(self):
871871
# Validate that all inputs have a corresponding output key.
872872
self._validate_task_inputs()
873873

874-
# Setup all tasks in the task listk
874+
# Setup all tasks in the task list
875875
for ii, task_spec in enumerate(self.task_specs):
876876
try:
877877
# Load the task instance and add it to the pipeline

caput/tests/conftest.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def setup(self, requires=None):
8787

8888
def process(self, _input):
8989
"""Run process."""
90-
print("Cooking %s %s eggs." % (self.style, input))
90+
print("Cooking %s %s eggs." % (self.style, _input))
9191

9292
def finish(self):
9393
"""Run finish."""
@@ -124,6 +124,25 @@ def write_output(self, filename, output, file_format=None, **kwargs):
124124
style: 'fried'
125125
"""
126126

127+
multi_eggs_pipeline_conf = """
128+
---
129+
pipeline:
130+
tasks:
131+
- type: caput.tests.conftest.GetEggs
132+
params: eggs_params
133+
out: [color, egg]
134+
- type: caput.tests.conftest.CookEggs
135+
params: cook_params
136+
in: egg
137+
- type: caput.tests.conftest.CookEggs
138+
params: cook_params
139+
in: color
140+
eggs_params:
141+
eggs: [['green', 'duck'], ['blue', 'ostrich']]
142+
cook_params:
143+
style: 'fried'
144+
"""
145+
127146

128147
def run_pipeline(parameters=None, configstr=eggs_pipeline_conf):
129148
"""Run `caput.scripts.runner run` with given parameters and config.

caput/tests/test_pipeline.py

+7
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@ def test_pipeline():
88
result = conftest.run_pipeline()
99
print(result.output)
1010
assert result.exit_code == 0
11+
12+
13+
def test_pipeline_multiple_outputs():
14+
"""Test running a very simple pipeline with a multi-output task."""
15+
result = conftest.run_pipeline(configstr=conftest.multi_eggs_pipeline_conf)
16+
print(result.output)
17+
assert result.exit_code == 0

0 commit comments

Comments
 (0)