Skip to content

Fix pydot tests #2019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions cwltool/cwlviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def _set_inner_edges(self) -> None:
self._dot_graph.add_node(n)
self._dot_graph.add_edge(
pydot.Edge(
str(inner_edge_row["source_step"]),
str(inner_edge_row["target_step"]),
pydot.quote_id_if_necessary(str(inner_edge_row["source_step"])),
pydot.quote_id_if_necessary(str(inner_edge_row["target_step"])),
)
)

Expand All @@ -109,7 +109,6 @@ def _set_input_edges(self) -> None:
inputs_subgraph = pydot.Subgraph(graph_name="cluster_inputs")
self._dot_graph.add_subgraph(inputs_subgraph)
inputs_subgraph.set("rank", "same")
inputs_subgraph.create_attribute_methods(["style"])
inputs_subgraph.set("style", "dashed")
inputs_subgraph.set("label", "Workflow Inputs")

Expand All @@ -129,14 +128,18 @@ def _set_input_edges(self) -> None:
)
n.set_name(str(input_row["input"]))
inputs_subgraph.add_node(n)
self._dot_graph.add_edge(pydot.Edge(str(input_row["input"]), str(input_row["step"])))
self._dot_graph.add_edge(
pydot.Edge(
pydot.quote_id_if_necessary(str(input_row["input"])),
pydot.quote_id_if_necessary(str(input_row["step"])),
)
)

def _set_output_edges(self) -> None:
get_output_edges = _get_output_edges_query()
outputs_graph = pydot.Subgraph(graph_name="cluster_outputs")
self._dot_graph.add_subgraph(outputs_graph)
outputs_graph.set("rank", "same")
outputs_graph.create_attribute_methods(["style"])
outputs_graph.set("style", "dashed")
outputs_graph.set("label", "Workflow Outputs")
outputs_graph.set("labelloc", "b")
Expand All @@ -156,7 +159,12 @@ def _set_output_edges(self) -> None:
)
n.set_name(str(output_edge_row["output"]))
outputs_graph.add_node(n)
self._dot_graph.add_edge(pydot.Edge(output_edge_row["step"], output_edge_row["output"]))
self._dot_graph.add_edge(
pydot.Edge(
pydot.quote_id_if_necessary(output_edge_row["step"]),
pydot.quote_id_if_necessary(output_edge_row["output"]),
)
)

def _get_root_graph_uri(self) -> rdflib.term.Identifier:
get_root_query = _get_root_query()
Expand Down
4 changes: 2 additions & 2 deletions mypy-stubs/pydot.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Sequence, Union
from typing import Any, Dict, List, Optional, Sequence, Union

PY3: Any
str_type = str
Expand All @@ -12,6 +12,7 @@ def is_windows() -> bool: ...
def is_anaconda() -> bool: ...
def get_executable_extension() -> str: ...
def graph_from_dot_data(s: str) -> List["Dot"]: ...
def quote_id_if_necessary(s: str, unquoted_keywords: Optional[Sequence[str]] = None) -> str: ...

class Common:
def set_parent_graph(self, parent_graph: "Graph") -> None: ...
Expand All @@ -21,7 +22,6 @@ class Common:
def get_attributes(self) -> Dict[str, str]: ...
def set_sequence(self, seq: str) -> None: ...
def get_sequence(self) -> str: ...
def create_attribute_methods(self, obj_attributes: List[str]) -> None: ...

class Error(Exception):
value: Any
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mypy-extensions
psutil>=5.6.6
importlib_resources>=1.4;python_version<'3.9'
coloredlogs
pydot>=1.4.1,<3
pydot>=1.4.1
argcomplete>=1.12.0
pyparsing!=3.0.2 # breaks --print-dot (pydot) https://github.com/pyparsing/pyparsing/issues/319
cwl-utils>=0.32
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _find_package_data(base: str, globs: list[str], root: str = "cwltool") -> li
"mypy-extensions",
"psutil >= 5.6.6",
"coloredlogs",
"pydot >= 1.4.1, <3",
"pydot >= 1.4.1",
"argcomplete >= 1.12.0",
"pyparsing != 3.0.2", # breaks --print-dot (pydot) https://github.com/pyparsing/pyparsing/issues/319
"cwl-utils >= 0.32",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_context.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging
import subprocess
import sys
from collections.abc import MutableMapping
from io import StringIO
from pathlib import Path
from typing import cast
from collections.abc import MutableMapping

from cwltool.context import RuntimeContext
from cwltool.factory import Factory
Expand Down