Skip to content

Commit f35f4e5

Browse files
committed
add tests for output specs MultiOutputFile and Directory
1 parent bb59551 commit f35f4e5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pydra/engine/tests/test_shelltask.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,7 +2769,7 @@ def gather_output(field, output_dir):
27692769

27702770
my_output_spec = SpecInfo(
27712771
name="Output",
2772-
fields=[("newfile", attr.ib(type=File, metadata={"callable": gather_output}))],
2772+
fields=[("newfile", attr.ib(type=MultiOutputFile, metadata={"callable": gather_output}))],
27732773
bases=(ShellOutSpec,),
27742774
)
27752775
shelly = ShellCommandTask(
@@ -2781,6 +2781,12 @@ def gather_output(field, output_dir):
27812781
# newfile is a list
27822782
assert len(res.output.newfile) == 2
27832783
assert all([file.exists for file in res.output.newfile])
2784+
assert (
2785+
shelly.output_names
2786+
== shelly.generated_output_names
2787+
== ["return_code", "stdout", "stderr", "newfile"]
2788+
)
2789+
27842790

27852791

27862792
@pytest.mark.parametrize("results_function", [result_no_submitter, result_submitter])
@@ -3106,6 +3112,7 @@ def get_stderr(stderr):
31063112
shelly = ShellCommandTask(
31073113
name="shelly", executable=cmd, args=args, output_spec=my_output_spec
31083114
).split("args")
3115+
31093116

31103117
results = results_function(shelly, plugin)
31113118
for index, res in enumerate(results):
@@ -3238,7 +3245,11 @@ def get_lowest_directory(directory_path):
32383245
cache_dir=tmpdir,
32393246
resultsDir="test", # Path(tmpdir) / "test" TODO: Not working without absolute path support
32403247
)
3241-
3248+
assert (
3249+
shelly.output_names
3250+
== shelly.generated_output_names
3251+
== ["return_code", "stdout", "stderr", "resultsDir"]
3252+
)
32423253
res = results_function(shelly, plugin)
32433254
print("Cache_dirr:", shelly.cache_dir)
32443255
assert (shelly.output_dir / Path("test")).exists() == True

0 commit comments

Comments
 (0)