Skip to content

Commit 096cbb4

Browse files
Ryan CaliRyan Cali
authored andcommitted
Updated tests
1 parent 3462466 commit 096cbb4

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

pydra/engine/audit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ def audit_task(self, task):
214214
start_message = {
215215
"@id": self.aid,
216216
"@type": "task",
217-
"Label": label,
217+
"Activity_Label": label,
218218
"Command": command,
219219
"StartedAtTime": now(),
220220
"AssociatedWith": version_cmd,
221221
}
222222

223223
entity_message = {
224224
"@id": self.aid,
225-
"Label": print(entity_label),
225+
"Entity_Label": print(entity_label),
226226
"AtLocation": at_location,
227227
"GeneratedBy": "test", # if not part of workflow, this will be none
228228
"Type": "Task",

pydra/engine/tests/test_task.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -993,22 +993,27 @@ def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)]
993993
return a + b
994994

995995
from glob import glob
996+
import json
996997

997998
funky = testfunc(a=2, audit_flags=AuditFlag.PROV, messengers=FileMessenger())
998999
funky.cache_dir = tmpdir
9991000
funky()
10001001
message_path = tmpdir / funky.checksum / "messages"
10011002
# go through each jsonld file in message_path and check if the label field exists
10021003
json_content = []
1004+
10031005
for file in glob(str(message_path) + "/*.jsonld"):
10041006
with open(file, "r") as f:
10051007
data = json.load(f)
10061008
print(data)
1007-
if "Label" in data:
1009+
if "Activity_Label" in data:
10081010
json_content.append(True)
1009-
assert "testfunc" == data["Label"]
1010-
if "AssociatedWith" in data:
1011-
assert None == data["AssociatedWith"]
1011+
assert data["Activity_Label"] == "testfunc"
1012+
if "Entity_Label" in data:
1013+
assert data["Entity_Label"] == None
1014+
if "AssociatedWith" in data:
1015+
assert None == data["AssociatedWith"]
1016+
10121017
assert any(json_content)
10131018

10141019

@@ -1035,7 +1040,7 @@ def test_audit_shellcommandtask(tmpdir):
10351040
with open(file, "r") as f:
10361041
data = json.load(f)
10371042
print(data)
1038-
if "Label" in data:
1043+
if "Activity_Label" in data:
10391044
label_content.append(True)
10401045
if "Command" in data:
10411046
command_content.append(True)
@@ -1174,7 +1179,7 @@ def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)]
11741179
from glob import glob
11751180

11761181
assert len(glob(str(tmpdir / funky.checksum / "proc*.log"))) == 1
1177-
assert len(glob(str(message_path / "*.jsonld"))) == 7
1182+
assert len(glob(str(message_path / "*.jsonld"))) == 8
11781183

11791184
# commented out to speed up testing
11801185
collect_messages(tmpdir / funky.checksum, message_path, ld_op="compact")

0 commit comments

Comments
 (0)