Skip to content

Commit b637b33

Browse files
committed
implemented more of Chris' suggestions
1 parent 131b18a commit b637b33

File tree

2 files changed

+6
-74
lines changed

2 files changed

+6
-74
lines changed

pydra/engine/tests/test_shelltask.py

Lines changed: 3 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ def test_shell_cmd_inputspec_10_err(tmp_path):
15551555
)
15561556

15571557

1558-
def test_shell_cmd_inputsspec_11(tmp_path):
1558+
def test_shell_cmd_inputspec_11(tmp_path):
15591559
input_fields = [
15601560
(
15611561
"inputFiles",
@@ -1599,7 +1599,7 @@ def test_shell_cmd_inputsspec_11(tmp_path):
15991599
wf.add(task)
16001600
wf.set_output([("out", wf.echoMultiple.lzout.outputFiles)])
16011601

1602-
with Submitter(plugin="serial") as sub:
1602+
with Submitter(plugin="cf") as sub:
16031603
sub(wf)
16041604
result = wf.result()
16051605

@@ -2781,74 +2781,6 @@ def test_shell_cmd_outputspec_3(plugin, results_function, tmp_path):
27812781
assert all([file.fspath.exists() for file in res.output.newfile])
27822782

27832783

2784-
@pytest.mark.xfail(
2785-
reason=(
2786-
"This test doesn't look like it ever worked properly. The command isn't being "
2787-
"split on ';' and instead the arguments are just treated as a list of dirs to create. "
2788-
"This includes 'tmp/newfile.txt', which fileformats now correctly detects as being "
2789-
"a directory instead of a file"
2790-
)
2791-
)
2792-
@pytest.mark.parametrize("results_function", [result_no_submitter, result_submitter])
2793-
def test_shell_cmd_outputspec_4(plugin, results_function, tmp_path):
2794-
"""
2795-
customised output_spec, adding files to the output,
2796-
using a wildcard in default (in the directory name)
2797-
"""
2798-
cmd = ["mkdir", "tmp1", ";", "touch", "tmp1/newfile.txt"]
2799-
my_output_spec = SpecInfo(
2800-
name="Output",
2801-
fields=[("newfile", File, "tmp*/newfile.txt")],
2802-
bases=(ShellOutSpec,),
2803-
)
2804-
shelly = ShellCommandTask(
2805-
name="shelly", executable=cmd, output_spec=my_output_spec, cache_dir=tmp_path
2806-
)
2807-
2808-
res = results_function(shelly, plugin)
2809-
assert res.output.stdout == ""
2810-
assert res.output.newfile.fspath.exists()
2811-
2812-
2813-
@pytest.mark.xfail(
2814-
reason=(
2815-
"This test doesn't look like it ever worked properly. The command isn't being "
2816-
"split on ';' and instead the arguments are just treated as a list of dirs to create. "
2817-
"This includes 'tmp/newfile.txt', which fileformats now correctly detects as being "
2818-
"a directory instead of a file"
2819-
)
2820-
)
2821-
@pytest.mark.parametrize("results_function", [result_no_submitter, result_submitter])
2822-
def test_shell_cmd_outputspec_4a(plugin, results_function, tmp_path):
2823-
"""
2824-
customised output_spec, adding files to the output,
2825-
using a wildcard in default (in the directory name), should collect two files
2826-
"""
2827-
cmd = [
2828-
"mkdir",
2829-
"tmp1",
2830-
"tmp2",
2831-
";",
2832-
"touch",
2833-
"tmp1/newfile.txt",
2834-
"tmp2/newfile.txt",
2835-
]
2836-
my_output_spec = SpecInfo(
2837-
name="Output",
2838-
fields=[("newfile", MultiOutputFile, "tmp*/newfile.txt")],
2839-
bases=(ShellOutSpec,),
2840-
)
2841-
shelly = ShellCommandTask(
2842-
name="shelly", executable=cmd, output_spec=my_output_spec, cache_dir=tmp_path
2843-
)
2844-
2845-
res = results_function(shelly, plugin)
2846-
assert res.output.stdout == ""
2847-
# newfile is a list
2848-
assert len(res.output.newfile) == 2
2849-
assert all([file.exists for file in res.output.newfile])
2850-
2851-
28522784
@pytest.mark.parametrize("results_function", [result_no_submitter, result_submitter])
28532785
def test_shell_cmd_outputspec_5(plugin, results_function, tmp_path):
28542786
"""
@@ -3185,7 +3117,7 @@ def test_shell_cmd_outputspec_7a(tmp_path, plugin, results_function):
31853117
files_id=new_files_id,
31863118
)
31873119

3188-
res = results_function(shelly, "serial")
3120+
res = results_function(shelly, plugin)
31893121
assert res.output.stdout == ""
31903122
assert res.output.new_files.fspath.exists()
31913123

pydra/engine/tests/test_task.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def testfunc(a: MultiInputObj):
379379
return len(a)
380380

381381
funky = testfunc(a=3.5)
382-
assert getattr(funky.inputs, "a") == MultiInputObj([3.5])
382+
assert getattr(funky.inputs, "a") == [3.5]
383383
res = funky()
384384
assert res.output.out == 1
385385

@@ -394,7 +394,7 @@ def testfunc(a: MultiInputObj):
394394
return len(a)
395395

396396
funky = testfunc(a=[3.5])
397-
assert getattr(funky.inputs, "a") == MultiInputObj([3.5])
397+
assert getattr(funky.inputs, "a") == [3.5]
398398
res = funky()
399399
assert res.output.out == 1
400400

@@ -412,7 +412,7 @@ def testfunc(a: MultiInputObj):
412412
funky = testfunc()
413413
# setting a after init
414414
funky.inputs.a = 3.5
415-
assert getattr(funky.inputs, "a") == MultiInputObj([3.5])
415+
assert getattr(funky.inputs, "a") == [3.5]
416416
res = funky()
417417
assert res.output.out == 1
418418

0 commit comments

Comments
 (0)