-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
base: main
Are you sure you want to change the base?
Fix pydot tests #2019
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2019 +/- ##
===========================================
- Coverage 83.78% 54.92% -28.86%
===========================================
Files 46 46
Lines 8262 8260 -2
Branches 2199 2103 -96
===========================================
- Hits 6922 4537 -2385
- Misses 858 3185 +2327
- Partials 482 538 +56 ☔ View full report in Codecov by Sentry. |
The test fails for the same reason it failed for me locally: https://github.com/common-workflow-language/cwltool/actions/runs/9964048376/job/27541027817 The reason is that |
@lkk7 Interesting, I've triggered a re-run of the CI on the main branch to see if there has been a regression related to one of our dependencies since July 12th https://github.com/common-workflow-language/cwltool/actions/runs/9905754128 |
@lkk7 When we pin to a pydot before version 3, all the CI tests still pass: https://github.com/common-workflow-language/cwltool/actions/runs/9976419287/job/27568552139 |
That's an old issue, but could we retry the CI now? Or has this been solved already? |
@lkk7 Since you started this PR we capped the pydot version to be less than 3. So now that we've rebased the PR I had to add a revert of that pydot version cap commit. We can now compare the pending test results (with pydot 3.x) to the results without pydot 3.x. |
@lkk7 Looks like there is a behavior change with pydot 3.x (3.0.1, specifically)
|
I can't pinpoint the exact fix yet, but the bug appears in def printdot(
wf: Process,
ctx: ContextType,
stdout: IO[str],
) -> None:
cwl_viewer: CWLViewer = CWLViewer(printrdf(wf, ctx, "n3"))
stdout.write(cwl_viewer.dot().replace(f"{wf.metadata['id']}#", "")) ### <<< HERE It's all about those file paths.
In 3.0.0+ the @ferdnyc, Could you confirm my suspicion. I know you were not involved in this one, but you made the change that affect this ( |
After a year, I've looked at this again, and I think again that this is because of the handling of port syntax, (the The thing happens here in
As we see in the failed test log posted above:
The problem occurs specifically here:
The replacement isnt working anymore, because it wants to erase I'm not sure if we can just revert back to the previous behavior which ignored it, because theoretically it's unsafe. But it's possible that the quoting behavior is too tight and I'll mention it in the upcoming PR. An ugly alternative is to adjust the |
Apologies, just seeing this for the first time. The port conjecture is likely; the way to overcome that would be to explicitly quote the ID string. (So, That's consistent with graphviz's own parser, since: graph G {
# Either of these will break (syntax error),
# since it can't parse slashes in an unquoted port value
file:///some/path#fragment [label="\N"];
file:///some/path [label="\N"];
} graph G {
# These are all exactly equivalent,
# any will create a node named "file"
file:somepath [label="\N"];
"file":"somepath" [label="\N"];
file:"///some/path#fragment" [label="\N"];
} graph G {
# This will create a node named "file:///some/path#fragment"
"file:///some/path#fragment" [label="\N"];
} |
Without knowing more about the context, I can't say where the behavior changed, but if Pydot 2.x was processing input differently it was probably doing it wrong in ways that would break on valid syntax. Like node IDs with |
This reverts commit 3299069.
@ferdnyc Thanks for the suggestion! Of course we can quote it. Why didn't I think of that? |
Could you approve the workflow? The latest commit should make the tests pass. Disclaimer: This change only satisfies the tests, which aren't 100% exhaustive. |
Because then I wouldn't get the chance to sound Clever™! |
Actually, it looks like these are edges, since even Pydot 4.x won't actually output the port part of a Node definition (as I said, it's meaningless); but the difference is in how the Edge endpoints are output (not parsed). Pydot does a lot of DWIMming. So if the user creates a technically-invalid edge endpoint like But whereas Pydot 2.x, 3.x, and 4.x would all output a simple set of endpoints like >>> import pydot
>>> pydot.__version__
'2.0.0'
>>> e = pydot.Edge("a:p1", "b:p2")
>>> e.to_string()
'a:p1 -- b:p2;' The difference is in how they DWIM endpoints that do require quoting. Pydot 2.x just threw quotes around the entire endpoint string, making it unnecessarily difficult to create endpoints with port values: >>> import pydot
>>> pydot.__version__
'2.0.0'
>>> e = pydot.Edge("a:p2!", "b:p4!")
>>> e.to_string()
'"a:p2!" -- "b:p4!";'
>>> e = pydot.Edge("a?:p1", "b?:p2")
>>> e.to_string()
'"a?:p1" -- "b?:p2";' Pydot 3.x+ is smarter, and knows how to properly quote an >>> import pydot
>>> pydot.__version__
'4.0.1.dev0'
>>> e = pydot.Edge("a:p2!", "b:p4!")
>>> e.to_string()
'a:"p2!" -- b:"p4!";'
>>> e = pydot.Edge("a?:p2", "b?:p4")
>>> e.to_string()
'"a?":p2 -- "b?":p4;' ...which does mean that now, when you don't want that colon to represent the |
No description provided.