fix: don't draw large graphs in artifacts

This commit is contained in:
Umut
2022-07-08 10:50:42 +02:00
parent 35e46aca69
commit 0a85731a3a

View File

@@ -103,14 +103,16 @@ class DebugArtifacts:
textual_representation = graph.format()
self.textual_representations_of_graphs[name].append(textual_representation)
try:
drawing = graph.draw()
self.drawings_of_graphs[name].append(str(drawing))
except ImportError as error: # pragma: no cover
if "pygraphviz" in str(error):
pass
else:
raise error
# 100 is an arbitrary number after which the drawing would become too hard to follow
if len(graph.graph.nodes()) < 100:
try:
drawing = graph.draw()
self.drawings_of_graphs[name].append(str(drawing))
except ImportError as error: # pragma: no cover
if "pygraphviz" in str(error):
pass
else:
raise error
self.final_graph = graph