1 diff --git a/objgraph.py b/objgraph.py
2 index 88e307b..0369f49 100755
5 @@ -1045,12 +1045,12 @@ def _present_graph(dot_filename, filename=None):
6 if not filename and _program_in_path('xdot'):
7 print("Spawning graph viewer (xdot)")
8 subprocess.Popen(['xdot', dot_filename], close_fds=True)
9 - elif _program_in_path('dot'):
10 + elif True: # path to dot is hardcoded and hence always in $PATH
12 print("Graph viewer (xdot) not found, generating a png instead")
13 filename = dot_filename[:-4] + '.png'
14 stem, ext = os.path.splitext(filename)
15 - cmd = ['dot', '-T' + ext[1:], '-o' + filename, dot_filename]
16 + cmd = ['@graphviz@/bin/dot', '-T' + ext[1:], '-o' + filename, dot_filename]
17 dot = subprocess.Popen(cmd, close_fds=False)
19 if dot.returncode != 0:
20 diff --git a/tests.py b/tests.py
21 index 7db2888..bdb666e 100755
24 @@ -557,7 +557,7 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
25 self.programsInPath(['dot'])
26 objgraph._present_graph('foo.dot', 'bar.png')
28 - subprocess.Popen(['dot', '-Tpng', '-obar.png', 'foo.dot'])
29 + subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-obar.png', 'foo.dot'])
30 Image generated as bar.png
33 @@ -566,11 +566,12 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
34 objgraph.subprocess.should_fail = True
35 objgraph._present_graph('f.dot', 'b.png')
37 - subprocess.Popen(['dot', '-Tpng', '-ob.png', 'f.dot'])
38 - dot failed (exit code 1) while executing "dot -Tpng -ob.png f.dot"
39 + subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-ob.png', 'f.dot'])
40 + dot failed (exit code 1) while executing "@graphviz@/bin/dot -Tpng -ob.png f.dot"
43 - def test_present_png_no_dot(self):
44 + @unittest.skip("empty $PATH has no effect")
45 + def no_test_present_png_no_dot(self):
46 self.programsInPath([])
47 objgraph._present_graph('foo.dot', 'bar.png')
49 @@ -591,10 +592,11 @@ class PresentGraphTest(CaptureMixin, TemporaryDirectoryMixin,
50 objgraph._present_graph('foo.dot')
52 Graph viewer (xdot) not found, generating a png instead
53 - subprocess.Popen(['dot', '-Tpng', '-ofoo.png', 'foo.dot'])
54 + subprocess.Popen(['@graphviz@/bin/dot', '-Tpng', '-ofoo.png', 'foo.dot'])
55 Image generated as foo.png
58 + @unittest.skip("empty $PATH has no effect")
59 def test_present_no_xdot_and_no_not(self):
60 self.programsInPath([])
61 objgraph._present_graph('foo.dot')