Skip to content

Commit 662ade1

Browse files
Ryan CaliRyan Cali
authored andcommitted
Added two file test back
1 parent 15a7542 commit 662ade1

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

pydra/engine/tests/test_task.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,12 +1072,19 @@ def test_audit_shellcommandtask_file(tmpdir):
10721072
with open("test.txt", "w") as f:
10731073
f.write("This is a test")
10741074

1075+
with open("test2.txt", "w") as f:
1076+
f.write("This is a test")
1077+
10751078
# copy the test.txt file to the tmpdir
10761079
shutil.copy("test.txt", tmpdir)
1080+
shutil.copy("test2.txt", tmpdir)
1081+
10771082

10781083
cmd = "cat"
10791084
file_in = tmpdir / "test.txt"
1085+
file_in_2 = tmpdir / "test2.txt"
10801086
test_file_hash = hash_file(file_in)
1087+
test_file_hash_2 = hash_file(file_in_2)
10811088
my_input_spec = SpecInfo(
10821089
name="Input",
10831090
fields=[
@@ -1092,13 +1099,26 @@ def test_audit_shellcommandtask_file(tmpdir):
10921099
"mandatory": True,
10931100
},
10941101
),
1102+
),
1103+
(
1104+
"in_file_2",
1105+
attr.ib(
1106+
type=File,
1107+
metadata={
1108+
"position": 2,
1109+
"argstr": "",
1110+
"help_string": "text",
1111+
"mandatory": True,
1112+
},
1113+
),
10951114
),
10961115
],
10971116
bases=(ShellSpec,),
10981117
)
10991118
shelly = ShellCommandTask(
11001119
name="shelly",
11011120
in_file=file_in,
1121+
in_file_2=file_in_2,
11021122
input_spec=my_input_spec,
11031123
executable=cmd,
11041124
audit_flags=AuditFlag.PROV,
@@ -1112,11 +1132,12 @@ def test_audit_shellcommandtask_file(tmpdir):
11121132
data = json.load(x)
11131133
if "@type" in data:
11141134
if data["@type"] == "input":
1115-
if "AtLocation" in data:
1135+
if data["Label"] == "in_file":
11161136
assert data["AtLocation"] == str(file_in)
1117-
if "digest" in data:
1118-
assert data["digest"] == test_file_hash
1119-
1137+
assert data["digest"] == test_file_hash
1138+
if data["Label"] == "in_file_2":
1139+
assert data["AtLocation"] == str(file_in_2)
1140+
assert data["digest"] == test_file_hash_2
11201141

11211142
def test_audit_shellcommandtask_version(tmpdir):
11221143
import subprocess as sp

0 commit comments

Comments
 (0)