2020-04-24 23:36:52 +00:00
|
|
|
diff --git a/graphviz/backend.py b/graphviz/backend.py
|
2021-08-05 21:33:18 +00:00
|
|
|
index b66e616..3da4ef0 100644
|
2020-04-24 23:36:52 +00:00
|
|
|
--- a/graphviz/backend.py
|
|
|
|
+++ b/graphviz/backend.py
|
2021-08-05 21:33:18 +00:00
|
|
|
@@ -124,7 +124,7 @@ def command(engine: str, format_: str, filepath=None,
|
|
|
|
raise ValueError(f'unknown formatter: {formatter!r}')
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
output_format = [f for f in (format_, renderer, formatter) if f is not None]
|
2021-02-05 17:12:51 +00:00
|
|
|
- cmd = ['dot', '-K%s' % engine, '-T%s' % ':'.join(output_format)]
|
|
|
|
+ cmd = ['@graphviz@/bin/dot', '-K%s' % engine, '-T%s' % ':'.join(output_format)]
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
if filepath is None:
|
|
|
|
rendered = None
|
2021-08-05 21:33:18 +00:00
|
|
|
@@ -297,7 +297,7 @@ def unflatten(source: str,
|
2021-02-05 17:12:51 +00:00
|
|
|
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:
|
2021-08-05 21:33:18 +00:00
|
|
|
@@ -332,7 +332,7 @@ def version() -> typing.Tuple[int, ...]:
|
|
|
|
Graphviz Release version entry format:
|
2021-02-05 17:12:51 +00:00
|
|
|
https://gitlab.com/graphviz/graphviz/-/blob/f94e91ba819cef51a4b9dcb2d76153684d06a913/gen_version.py#L17-20
|
2020-04-24 23:36:52 +00:00
|
|
|
"""
|
|
|
|
- cmd = ['dot', '-V']
|
|
|
|
+ cmd = ['@graphviz@/bin/dot', '-V']
|
2020-09-25 04:45:31 +00:00
|
|
|
out, _ = run(cmd, check=True, encoding='ascii',
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.STDOUT)
|
2020-04-24 23:36:52 +00:00
|
|
|
diff --git a/tests/test_backend.py b/tests/test_backend.py
|
2021-08-05 21:33:18 +00:00
|
|
|
index e0a0e1c..681f178 100644
|
2020-04-24 23:36:52 +00:00
|
|
|
--- a/tests/test_backend.py
|
|
|
|
+++ b/tests/test_backend.py
|
2021-08-05 21:33:18 +00:00
|
|
|
@@ -54,7 +54,7 @@ def test_run_encoding_mocked(mocker, Popen, input='sp\xe4m', encoding='utf-8'):
|
2020-09-25 04:45:31 +00:00
|
|
|
m.decode.assert_called_once_with(encoding)
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
-@pytest.mark.exe
|
2020-04-24 23:36:52 +00:00
|
|
|
+@pytest.mark.skip(reason='empty $PATH has no effect')
|
|
|
|
@pytest.mark.usefixtures('empty_path')
|
2020-09-25 04:45:31 +00:00
|
|
|
@pytest.mark.parametrize('func, args', [
|
|
|
|
(render, ['dot', 'pdf', 'nonfilepath']),
|
2021-08-05 21:33:18 +00:00
|
|
|
@@ -148,7 +148,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet): # noqa: N803
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
assert render('dot', 'pdf', 'nonfilepath', quiet=quiet) == 'nonfilepath.pdf'
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
- Popen.assert_called_once_with(['dot', '-Kdot', '-Tpdf', '-O', 'nonfilepath'],
|
|
|
|
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpdf', '-O', 'nonfilepath'],
|
2020-04-24 23:36:52 +00:00
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
2020-09-25 04:45:31 +00:00
|
|
|
cwd=None, startupinfo=mocker.ANY)
|
2021-08-05 21:33:18 +00:00
|
|
|
@@ -211,7 +211,7 @@ def test_pipe_pipe_invalid_data_mocked(mocker, Popen, quiet): # noqa: N803
|
|
|
|
assert e.value.stdout is out
|
2020-09-25 04:45:31 +00:00
|
|
|
e.value.stdout = mocker.sentinel.new_stdout
|
|
|
|
assert e.value.stdout is mocker.sentinel.new_stdout
|
2021-02-05 17:12:51 +00:00
|
|
|
- Popen.assert_called_once_with(['dot', '-Kdot', '-Tpng'],
|
|
|
|
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpng'],
|
2020-04-24 23:36:52 +00:00
|
|
|
stdin=subprocess.PIPE,
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
2021-02-05 17:12:51 +00:00
|
|
|
@@ -231,7 +231,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet): # noqa: N803
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
assert pipe('dot', 'png', b'nongraph', quiet=quiet) == b'stdout'
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
- 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'],
|
2020-04-24 23:36:52 +00:00
|
|
|
stdin=subprocess.PIPE,
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
2021-02-05 17:12:51 +00:00
|
|
|
@@ -290,7 +290,7 @@ def test_version_parsefail_mocked(mocker, Popen): # noqa: N803
|
2020-09-25 04:45:31 +00:00
|
|
|
with pytest.raises(RuntimeError, match=r'nonversioninfo'):
|
2020-04-24 23:36:52 +00:00
|
|
|
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)
|
2021-02-05 17:12:51 +00:00
|
|
|
@@ -312,7 +312,7 @@ def test_version_mocked(mocker, Popen, stdout, expected): # noqa: N803
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
assert version() == expected
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
- 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)
|