Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions pydra/engine/tests/test_shelltask.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,56 +1153,6 @@ def test_shell_cmd_inputspec_9(plugin, results_function, tmpdir):
assert res.output.stdout == "hello from boston"


def test_shell_cmd_inputspec_10_err(tmpdir):
""" checking if the proper error is raised when broken symlink is provided
as a input field with File as a type
"""

file_1 = tmpdir.join("file_1.txt")
with open(file_1, "w") as f:
f.write("hello")
file_2 = tmpdir.join("file_2.txt")

# creating symlink and removing the original file
os.symlink(file_1, file_2)
os.remove(file_1)

cmd_exec = "cat"

my_input_spec = SpecInfo(
name="Input",
fields=[
(
"files",
attr.ib(
type=File,
metadata={
"position": 1,
"argstr": "",
"help_string": "a file",
"mandatory": True,
},
),
)
],
bases=(ShellSpec,),
)

shelly = ShellCommandTask(
name="shelly", executable=cmd_exec, files=file_2, input_spec=my_input_spec
)

# checking if the broken symlink error is raised when checksum is calculated
with pytest.raises(FileNotFoundError) as e:
checksum = shelly.checksum
assert "Broken symlink" in str(e.value)

# checking if the broken symlink error is raised when the task is run
with pytest.raises(FileNotFoundError) as e:
res = shelly()
assert "Broken symlink" in str(e.value)


@pytest.mark.parametrize("results_function", [result_no_submitter, result_submitter])
def test_shell_cmd_inputspec_copyfile_1(plugin, results_function, tmpdir):
""" shelltask changes a file in place,
Expand Down