2018-12-19 13:53:12 +00:00
|
|
|
diff --git a/graphviz/backend.py b/graphviz/backend.py
|
2020-08-27 08:57:18 +01:00
|
|
|
index 6f4cc0c..bc4781e 100644
|
2018-12-19 13:53:12 +00:00
|
|
|
--- a/graphviz/backend.py
|
|
|
|
+++ b/graphviz/backend.py
|
2020-08-27 08:57:18 +01:00
|
|
|
@@ -122,7 +122,7 @@ def command(engine, format_, filepath=None, renderer=None, formatter=None):
|
|
|
|
raise ValueError('unknown formatter: %r' % formatter)
|
2018-12-19 13:53:12 +00:00
|
|
|
|
2020-08-27 08:57:18 +01:00
|
|
|
output_format = [f for f in (format_, renderer, formatter) if f is not None]
|
|
|
|
- cmd = [engine, '-T%s' % ':'.join(output_format)]
|
|
|
|
+ cmd = [os.path.join('@graphviz@/bin', engine), '-T%s' % ':'.join(output_format)]
|
|
|
|
|
|
|
|
if filepath is None:
|
|
|
|
rendered = None
|
|
|
|
@@ -255,7 +255,7 @@ def version():
|
2018-12-19 13:53:12 +00:00
|
|
|
subprocess.CalledProcessError: If the exit status is non-zero.
|
|
|
|
RuntimmeError: If the output cannot be parsed into a version number.
|
|
|
|
"""
|
|
|
|
- cmd = ['dot', '-V']
|
|
|
|
+ cmd = ['@graphviz@/bin/dot', '-V']
|
2020-08-27 08:57:18 +01:00
|
|
|
out, _ = run(cmd, check=True, encoding='ascii',
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.STDOUT)
|
2018-12-19 13:53:12 +00:00
|
|
|
diff --git a/tests/test_backend.py b/tests/test_backend.py
|
2020-08-27 08:57:18 +01:00
|
|
|
index 9f307f5..e43bf5b 100644
|
2018-12-19 13:53:12 +00:00
|
|
|
--- a/tests/test_backend.py
|
|
|
|
+++ b/tests/test_backend.py
|
2020-08-27 08:57:18 +01:00
|
|
|
@@ -50,7 +50,7 @@ def test_run_encoding_mocked(mocker, Popen, input=u'sp\xe4m', encoding='utf-8'):
|
|
|
|
m.decode.assert_called_once_with(encoding)
|
2018-12-19 13:53:12 +00:00
|
|
|
|
|
|
|
|
2020-08-27 08:57:18 +01:00
|
|
|
-@pytest.exe
|
2018-12-19 13:53:12 +00:00
|
|
|
+@pytest.mark.skip(reason='empty $PATH has no effect')
|
|
|
|
@pytest.mark.usefixtures('empty_path')
|
2020-08-27 08:57:18 +01:00
|
|
|
@pytest.mark.parametrize('func, args', [
|
|
|
|
(render, ['dot', 'pdf', 'nonfilepath']),
|
|
|
|
@@ -143,7 +143,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet): # noqa: N803
|
2018-12-19 13:53:12 +00:00
|
|
|
|
|
|
|
assert render('dot', 'pdf', 'nonfilepath', quiet=quiet) == 'nonfilepath.pdf'
|
|
|
|
|
|
|
|
- Popen.assert_called_once_with(['dot', '-Tpdf', '-O', 'nonfilepath'],
|
|
|
|
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpdf', '-O', 'nonfilepath'],
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
2020-08-27 08:57:18 +01:00
|
|
|
cwd=None, startupinfo=mocker.ANY)
|
|
|
|
@@ -201,7 +201,7 @@ def test_pipe_pipe_invalid_data_mocked(mocker, py2, Popen, quiet): # noqa: N803
|
2018-12-19 13:53:12 +00:00
|
|
|
assert e.value.stdout is mocker.sentinel.out
|
2020-08-27 08:57:18 +01:00
|
|
|
e.value.stdout = mocker.sentinel.new_stdout
|
|
|
|
assert e.value.stdout is mocker.sentinel.new_stdout
|
2018-12-19 13:53:12 +00:00
|
|
|
- Popen.assert_called_once_with(['dot', '-Tpng'],
|
|
|
|
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpng'],
|
|
|
|
stdin=subprocess.PIPE,
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
2020-08-27 08:57:18 +01:00
|
|
|
@@ -224,7 +224,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet): # noqa: N803
|
2018-12-19 13:53:12 +00:00
|
|
|
|
|
|
|
assert pipe('dot', 'png', b'nongraph', quiet=quiet) is mocker.sentinel.out
|
|
|
|
|
|
|
|
- Popen.assert_called_once_with(['dot', '-Tpng'],
|
|
|
|
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpng'],
|
|
|
|
stdin=subprocess.PIPE,
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE,
|
2020-08-27 08:57:18 +01:00
|
|
|
@@ -250,7 +250,7 @@ def test_version_parsefail_mocked(mocker, Popen): # noqa: N803
|
|
|
|
with pytest.raises(RuntimeError, match=r'nonversioninfo'):
|
2018-12-19 13:53:12 +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)
|
2020-08-27 08:57:18 +01:00
|
|
|
@@ -269,7 +269,7 @@ def test_version_mocked(mocker, Popen, stdout, expected): # noqa: N803
|
2018-12-19 13:53:12 +00:00
|
|
|
|
2020-08-27 08:57:18 +01:00
|
|
|
assert version() == expected
|
2018-12-19 13:53:12 +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)
|