Skip to content

Commit

Permalink
Revert warning and test for the graphviz call+windows combination (#275)
Browse files Browse the repository at this point in the history
Whatever was broken in the upstream dependency or github image seems to be fixed.
  • Loading branch information
liamhuber authored Apr 3, 2024
1 parent ec8280a commit 21c8696
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 35 deletions.
11 changes: 1 addition & 10 deletions pyiron_workflow/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import sys
from abc import ABC
from concurrent.futures import Future
import platform
from typing import Any, Literal, Optional, TYPE_CHECKING
import warnings

Expand Down Expand Up @@ -647,16 +646,8 @@ def draw(
Returns:
(graphviz.graphs.Digraph): The resulting graph object.
Warnings:
Rendering a PDF format appears to not be working on Windows right now.
"""
if format == "pdf" and platform.system() == "Windows":
warnings.warn(
"Graphviz does not appear to be playing well with Windows right now,"
"this will probably fail and you will need to try a different format."
"If it _doesn't_ fail, please contact the developers by raising an "
"issue at github.com/pyiron/pyiron_workflow"
)

if size is not None:
size = f"{size[0]},{size[1]}"
graph = GraphvizNode(self, depth=depth, rankdir=rankdir, size=size).graph
Expand Down
36 changes: 11 additions & 25 deletions tests/unit/test_node.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from concurrent.futures import Future
import os
import platform
from subprocess import CalledProcessError
import sys
from typing import Literal, Optional
import unittest
Expand Down Expand Up @@ -322,29 +320,17 @@ def test_draw(self):

for fmt in ["pdf", "png"]:
with self.subTest(f"Testing with format {fmt}"):
if fmt == "pdf" and platform.system() == "Windows":
with self.assertRaises(
CalledProcessError,
msg="Graphviz doesn't seem to be happy about the "
"combindation PDF format and Windows right now. We "
"throw a warning for it in `Node.draw`, so if this "
"test ever fails and this combination _doesn't_ fail, "
"remove this extra bit of testing and remove the "
"warning."
):
self.n1.draw(save=True, format=fmt)
else:
self.n1.draw(save=True, format=fmt)
expected_name = self.n1.label + "_graph." + fmt
# That name is just an implementation detail, update it as
# needed
self.assertTrue(
self.n1.working_directory.path.joinpath(
expected_name
).is_file(),
msg="If `save` is called, expect the rendered image to "
"exist in the working directory"
)
self.n1.draw(save=True, format=fmt)
expected_name = self.n1.label + "_graph." + fmt
# That name is just an implementation detail, update it as
# needed
self.assertTrue(
self.n1.working_directory.path.joinpath(
expected_name
).is_file(),
msg="If `save` is called, expect the rendered image to "
"exist in the working directory"
)

user_specified_name = "foo"
self.n1.draw(filename=user_specified_name, format=fmt)
Expand Down

0 comments on commit 21c8696

Please sign in to comment.