Skip to content

Commit 0626db4

Browse files
authored
Merge pull request #402 from djarecka/ci/binding_tets
adding tests for docker
2 parents 729bea8 + e0fde5c commit 0626db4

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

pydra/engine/tests/test_dockertask.py

+48
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,54 @@ def test_docker_inputspec_1a(tmpdir):
736736
assert res.output.stdout == "hello from pydra"
737737

738738

739+
@no_win
740+
@need_docker
741+
def test_docker_inputspec_1b(tmpdir):
742+
""" a simple customized input spec for docker task
743+
instead of using automatic binding I provide the bindings
744+
and name of the file inside the container
745+
"""
746+
filename = str(tmpdir.join("file_pydra.txt"))
747+
with open(filename, "w") as f:
748+
f.write("hello from pydra")
749+
750+
cmd = "cat"
751+
752+
my_input_spec = SpecInfo(
753+
name="Input",
754+
fields=[
755+
(
756+
"file",
757+
attr.ib(
758+
type=File,
759+
metadata={
760+
"mandatory": True,
761+
"position": 1,
762+
"argstr": "",
763+
"help_string": "input file",
764+
"container_path": True,
765+
},
766+
),
767+
)
768+
],
769+
bases=(DockerSpec,),
770+
)
771+
772+
docky = DockerTask(
773+
name="docky",
774+
image="busybox",
775+
executable=cmd,
776+
# container_path is set to True, so providing the filename inside the container
777+
file="/in_container/file_pydra.txt",
778+
bindings=[(str(tmpdir), "/in_container")],
779+
input_spec=my_input_spec,
780+
strip=True,
781+
)
782+
783+
res = docky()
784+
assert res.output.stdout == "hello from pydra"
785+
786+
739787
@no_win
740788
@need_docker
741789
def test_docker_inputspec_1_dockerflag(tmpdir):

0 commit comments

Comments
 (0)