Skip to content

Commit

Permalink
Merge pull request #402 from djarecka/ci/binding_tets
Browse files Browse the repository at this point in the history
adding tests for docker
  • Loading branch information
djarecka authored Jan 13, 2021
2 parents 729bea8 + e0fde5c commit 0626db4
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions pydra/engine/tests/test_dockertask.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,54 @@ def test_docker_inputspec_1a(tmpdir):
assert res.output.stdout == "hello from pydra"


@no_win
@need_docker
def test_docker_inputspec_1b(tmpdir):
""" a simple customized input spec for docker task
instead of using automatic binding I provide the bindings
and name of the file inside the container
"""
filename = str(tmpdir.join("file_pydra.txt"))
with open(filename, "w") as f:
f.write("hello from pydra")

cmd = "cat"

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

docky = DockerTask(
name="docky",
image="busybox",
executable=cmd,
# container_path is set to True, so providing the filename inside the container
file="/in_container/file_pydra.txt",
bindings=[(str(tmpdir), "/in_container")],
input_spec=my_input_spec,
strip=True,
)

res = docky()
assert res.output.stdout == "hello from pydra"


@no_win
@need_docker
def test_docker_inputspec_1_dockerflag(tmpdir):
Expand Down

0 comments on commit 0626db4

Please sign in to comment.