Skip to content

Commit 50bdbfe

Browse files
committed
#44: adding tests for github actions
1 parent 3ea679d commit 50bdbfe

5 files changed

Lines changed: 8 additions & 19 deletions

File tree

tests/unit/test_workflow.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,3 @@ def test_workflow_add_dependencies_leaves(self, workflow: Workflow, tasks: list[
9898
workflow.add_dependency(previous_task.task_id, task.task_id)
9999
previous_task = task
100100
assert(workflow.leaves() == [previous_task.task_id])
101-
102-
@pytest.mark.unit
103-
def test_dot(self, workflow: Workflow) -> None:
104-
dot_file_path = pathlib.Path("/tmp/workflow_test.dot")
105-
workflow.add_task(Task(name="task_1", task_id="task_1", runtime=15.0))
106-
workflow.add_task(Task(name="task_2", task_id="task_2", runtime=30.0))
107-
workflow.add_dependency("task_1", "task_2")
108-
workflow.write_dot(dot_file_path)
109-
dot_workflow = Workflow("workflow")
110-
dot_workflow.read_dot(dot_file_path)
111-
# assert(workflow == dot_workflow)

wfcommons/common/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# (at your option) any later version.
1010

1111
from .workflow import Workflow
12-
from .file import File
13-
from .file import FileLink
14-
from .task import Task
15-
from .task import TaskType
12+
from .file import File, FileLink
13+
from .task import Task, TaskType
14+
from .machine import Machine, MachineSystem

wfcommons/common/file.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ def as_dict(self) -> Dict[str, Union[str, int, FileLink]]:
5353
'id': self.file_id,
5454
'sizeInBytes': self.size
5555
}
56+
57+
def __str__(self) -> str:
58+
return self.file_id

wfcommons/common/task.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,14 @@ def specification_as_dict(self) -> Dict:
124124
:return: A JSON object representation of the task.
125125
:rtype: Dict
126126
"""
127-
task_obj = {
127+
return {
128128
'name': self.name,
129129
'id': self.task_id,
130130
'parents': [],
131131
'children': [],
132132
'inputFiles': [f.file_id for f in self.input_files],
133133
'outputFiles': [f.file_id for f in self.output_files]
134134
}
135-
return task_obj
136135

137136
def execution_as_dict(self) -> Dict:
138137
"""A JSON representation of the task execution.

wfcommons/common/workflow.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ def read_dot(self, dot_file_path: Optional[pathlib.Path] = None) -> None:
229229
tasks_map = {}
230230
for node in graph.nodes(data=True):
231231
task_id = f"{node[1]['label']}_ID{node[0]}"
232-
task = Task(name=node[1]['label'], task_id=task_id, runtime=0)
233-
self.add_task(task)
232+
self.add_task(Task(name=node[1]['label'], task_id=task_id, runtime=0))
234233
tasks_map[node[0]] = task_id
235234

236235
for edge in graph.edges:

0 commit comments

Comments
 (0)