Skip to content

Commit e425b83

Browse files
authored
Merge pull request #704 from djarecka/fix/tmp_dir
adding cache_dir to tests
2 parents 7b5e68e + 4937232 commit e425b83

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

pydra/engine/tests/test_shelltask.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,14 +2460,14 @@ def test_wf_shell_cmd_3a(plugin, tmp_path):
24602460
assert res.output.cp_file.fspath.exists()
24612461

24622462

2463-
def test_wf_shell_cmd_state_1(plugin):
2463+
def test_wf_shell_cmd_state_1(plugin, tmp_path):
24642464
"""a workflow with 2 tasks and splitter on the wf level,
24652465
first one has input with output_file_template (str, uses wf.lzin),
24662466
that is passed to the second task
24672467
"""
2468-
wf = Workflow(name="wf", input_spec=["cmd1", "cmd2", "args"]).split(
2469-
"args", args=["newfile_1.txt", "newfile_2.txt"]
2470-
)
2468+
wf = Workflow(
2469+
name="wf", input_spec=["cmd1", "cmd2", "args"], cache_dir=tmp_path
2470+
).split("args", args=["newfile_1.txt", "newfile_2.txt"])
24712471

24722472
wf.inputs.cmd1 = "touch"
24732473
wf.inputs.cmd2 = "cp"
@@ -2820,7 +2820,7 @@ def gather_output(field, output_dir):
28202820

28212821

28222822
@pytest.mark.parametrize("results_function", [result_no_submitter, result_submitter])
2823-
def test_shell_cmd_outputspec_5a(plugin, results_function):
2823+
def test_shell_cmd_outputspec_5a(plugin, results_function, tmp_path):
28242824
"""
28252825
customised output_spec, adding files to the output,
28262826
using a function to collect output, the function is saved in the field metadata
@@ -2842,7 +2842,9 @@ def gather_output(executable, output_dir):
28422842
],
28432843
bases=(ShellOutSpec,),
28442844
)
2845-
shelly = ShellCommandTask(name="shelly", executable=cmd, output_spec=my_output_spec)
2845+
shelly = ShellCommandTask(
2846+
name="shelly", executable=cmd, output_spec=my_output_spec, cache_dir=tmp_path
2847+
)
28462848

28472849
res = results_function(shelly, plugin)
28482850
assert res.output.stdout == ""
@@ -2874,7 +2876,7 @@ def gather_output(executable, output_dir, ble):
28742876

28752877

28762878
@pytest.mark.parametrize("results_function", [result_no_submitter, result_submitter])
2877-
def test_shell_cmd_outputspec_5c(plugin, results_function):
2879+
def test_shell_cmd_outputspec_5c(plugin, results_function, tmp_path):
28782880
"""
28792881
Customised output spec defined as a class,
28802882
using a static function to collect output files.
@@ -2893,6 +2895,7 @@ def gather_output(executable, output_dir):
28932895
name="shelly",
28942896
executable=["touch", "newfile_tmp1.txt", "newfile_tmp2.txt"],
28952897
output_spec=SpecInfo(name="Output", bases=(MyOutputSpec,)),
2898+
cache_dir=tmp_path,
28962899
)
28972900

28982901
res = results_function(shelly, plugin)
@@ -3177,7 +3180,7 @@ def get_stderr(stderr):
31773180
)
31783181

31793182
shelly = ShellCommandTask(
3180-
name="shelly", executable=cmd, output_spec=my_output_spec
3183+
name="shelly", executable=cmd, output_spec=my_output_spec, cache_dir=tmp_path
31813184
).split("args", args=args)
31823185

31833186
results = results_function(shelly, plugin)
@@ -3248,6 +3251,7 @@ def get_lowest_directory(directory_path):
32483251
executable=cmd,
32493252
output_spec=my_output_spec,
32503253
resultsDir="outdir",
3254+
cache_dir=tmp_path,
32513255
).split("args", args=args)
32523256

32533257
results_function(shelly, plugin)

0 commit comments

Comments
 (0)