3030 ("my_regressions" , MY_REGRESSION_TESTS_DIR ),
3131)
3232
33+ DEFAULT_FORMAT = "png"
34+
3335
3436def list_dots (path ):
3537 searchpath = os .path .join (path , "*.dot" )
@@ -57,7 +59,7 @@ def pytest_generate_tests(metafunc):
5759
5860def _render_with_graphviz (filename ):
5961 p = subprocess .Popen (
60- (DOT_BINARY_PATH , "-Tjpe" ),
62+ (DOT_BINARY_PATH , "-T{}" . format ( DEFAULT_FORMAT ) ),
6163 cwd = os .path .dirname (filename ),
6264 stdin = open (filename , "rt" ),
6365 stderr = subprocess .PIPE ,
@@ -77,8 +79,8 @@ def _render_with_graphviz(filename):
7779 if stdout_output :
7880 stdout_output = NULL_SEP .join (stdout_output )
7981
80- # this returns a status code we should check
81- p . wait ()
82+ ret = p . wait ()
83+ assert ret == 0 , "graphviz quit with error"
8284
8385 return sha256 (stdout_output ).hexdigest ()
8486
@@ -87,8 +89,8 @@ def _render_with_pydot(filename):
8789 g = pydot .graph_from_dot_file (filename )
8890 if not isinstance (g , list ):
8991 g = [g ]
90- jpe_data = NULL_SEP .join ([_g .create (format = "jpe" ) for _g in g ])
91- return sha256 (jpe_data ).hexdigest ()
92+ image_data = NULL_SEP .join ([_g .create (format = DEFAULT_FORMAT ) for _g in g ])
93+ return sha256 (image_data ).hexdigest ()
9294
9395
9496def test_render_and_compare_dot_files (filepath ):
@@ -113,8 +115,8 @@ def test_graph_with_shapefiles():
113115 #
114116 g = pydot .graph_from_dot_data (graph_data )
115117 g .set_shape_files (pngs )
116- jpe_data = g .create (format = "jpe" )
117- hexdigest = sha256 (jpe_data ).hexdigest ()
118+ image_data = g .create (format = DEFAULT_FORMAT )
119+ hexdigest = sha256 (image_data ).hexdigest ()
118120 hexdigest_original = _render_with_graphviz (dot_file )
119121
120122 assert hexdigest == hexdigest_original
0 commit comments