summary refs log tree commit diff
path: root/pkgs/development/python-modules/graphviz/hardcode-graphviz-path.patch
blob: fa2f634bbc294503b03b62d7ccc5c9cf1a80958a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
diff --git a/graphviz/backend.py b/graphviz/backend.py
index d2c4b97..f7175cd 100644
--- a/graphviz/backend.py
+++ b/graphviz/backend.py
@@ -122,7 +122,7 @@ def command(engine, format_, filepath=None, renderer=None, formatter=None):
         raise ValueError('unknown formatter: %r' % formatter)
 
     output_format = [f for f in (format_, renderer, formatter) if f is not None]
-    cmd = ['dot', '-K%s' % engine, '-T%s' % ':'.join(output_format)]
+    cmd = ['@graphviz@/bin/dot', '-K%s' % engine, '-T%s' % ':'.join(output_format)]
 
     if filepath is None:
         rendered = None
@@ -275,7 +275,7 @@ def unflatten(source,
     if fanout and stagger is None:
         raise RequiredArgumentError('fanout given without stagger')
 
-    cmd = ['unflatten']
+    cmd = ['@graphviz@/bin/unflatten']
     if stagger is not None:
         cmd += ['-l', str(stagger)]
     if fanout:
@@ -304,7 +304,7 @@ def version():
         Graphviz Release version entry format
         https://gitlab.com/graphviz/graphviz/-/blob/f94e91ba819cef51a4b9dcb2d76153684d06a913/gen_version.py#L17-20
     """
-    cmd = ['dot', '-V']
+    cmd = ['@graphviz@/bin/dot', '-V']
     out, _ = run(cmd, check=True, encoding='ascii',
                  stdout=subprocess.PIPE,
                  stderr=subprocess.STDOUT)
diff --git a/tests/test_backend.py b/tests/test_backend.py
index d10ef1a..e4aba58 100644
--- a/tests/test_backend.py
+++ b/tests/test_backend.py
@@ -52,7 +52,7 @@ def test_run_encoding_mocked(mocker, Popen, input=u'sp\xe4m', encoding='utf-8'):
         m.decode.assert_called_once_with(encoding)
 
 
-@pytest.exe
+@pytest.mark.skip(reason='empty $PATH has no effect')
 @pytest.mark.usefixtures('empty_path')
 @pytest.mark.parametrize('func, args', [
     (render, ['dot', 'pdf', 'nonfilepath']),
@@ -146,7 +146,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet):  # noqa: N803
 
     assert render('dot', 'pdf', 'nonfilepath', quiet=quiet) == 'nonfilepath.pdf'
 
-    Popen.assert_called_once_with(['dot', '-Kdot', '-Tpdf', '-O', 'nonfilepath'],
+    Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpdf', '-O', 'nonfilepath'],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE,
                                   cwd=None, startupinfo=mocker.ANY)
@@ -208,7 +208,7 @@ def test_pipe_pipe_invalid_data_mocked(mocker, py2, Popen, quiet):  # noqa: N803
     assert e.value.stdout is mocker.sentinel.out
     e.value.stdout = mocker.sentinel.new_stdout
     assert e.value.stdout is mocker.sentinel.new_stdout
-    Popen.assert_called_once_with(['dot', '-Kdot', '-Tpng'],
+    Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpng'],
                                   stdin=subprocess.PIPE,
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE,
@@ -231,7 +231,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet):  # noqa: N803
 
     assert pipe('dot', 'png', b'nongraph', quiet=quiet) is mocker.sentinel.out
 
-    Popen.assert_called_once_with(['dot', '-Kdot', '-Tpng'],
+    Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpng'],
                                   stdin=subprocess.PIPE,
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE,
@@ -259,7 +259,7 @@ def test_unflatten_mocked(capsys, mocker, Popen):
     proc.communicate.return_value = (b'nonresult', b'')
 
     assert unflatten('nonsource') == 'nonresult'
-    Popen.assert_called_once_with(['unflatten'],
+    Popen.assert_called_once_with(['@graphviz@/bin/unflatten'],
                                   stdin=subprocess.PIPE,
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE,
@@ -290,7 +290,7 @@ def test_version_parsefail_mocked(mocker, Popen):  # noqa: N803
     with pytest.raises(RuntimeError, match=r'nonversioninfo'):
         version()
 
-    Popen.assert_called_once_with(['dot', '-V'],
+    Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.STDOUT,
                                   startupinfo=mocker.ANY)
@@ -312,7 +312,7 @@ def test_version_mocked(mocker, Popen, stdout, expected):  # noqa: N803
 
     assert version() == expected
 
-    Popen.assert_called_once_with(['dot', '-V'],
+    Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.STDOUT,
                                   startupinfo=mocker.ANY)