Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.03 4.4 kB view raw
1diff --git a/graphviz/backend.py b/graphviz/backend.py 2index 704017b..fe4aefe 100644 3--- a/graphviz/backend.py 4+++ b/graphviz/backend.py 5@@ -114,7 +114,7 @@ def command(engine, format, filepath=None, renderer=None, formatter=None): 6 suffix = '.'.join(reversed(format_arg)) 7 format_arg = ':'.join(format_arg) 8 9- cmd = [engine, '-T%s' % format_arg] 10+ cmd = [os.path.join('@graphviz@/bin', engine), '-T%s' % format_arg] 11 rendered = None 12 if filepath is not None: 13 cmd.extend(['-O', filepath]) 14@@ -217,7 +217,7 @@ def version(): 15 subprocess.CalledProcessError: If the exit status is non-zero. 16 RuntimmeError: If the output cannot be parsed into a version number. 17 """ 18- cmd = ['dot', '-V'] 19+ cmd = ['@graphviz@/bin/dot', '-V'] 20 out, _ = run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 21 22 info = out.decode('ascii') 23diff --git a/tests/test_backend.py b/tests/test_backend.py 24index 7ec12f7..2e8550d 100644 25--- a/tests/test_backend.py 26+++ b/tests/test_backend.py 27@@ -47,6 +47,7 @@ def test_render_formatter_unknown(): 28 render('dot', 'ps', 'nonfilepath', 'ps', '') 29 30 31+@pytest.mark.skip(reason='empty $PATH has no effect') 32 @pytest.mark.usefixtures('empty_path') 33 def test_render_missing_executable(): 34 with pytest.raises(ExecutableNotFound, match=r'execute'): 35@@ -85,7 +86,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet): 36 37 assert render('dot', 'pdf', 'nonfilepath', quiet=quiet) == 'nonfilepath.pdf' 38 39- Popen.assert_called_once_with(['dot', '-Tpdf', '-O', 'nonfilepath'], 40+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpdf', '-O', 'nonfilepath'], 41 stdout=subprocess.PIPE, 42 stderr=subprocess.PIPE, 43 startupinfo=mocker.ANY) 44@@ -94,6 +95,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet): 45 assert capsys.readouterr() == ('', '' if quiet else 'stderr') 46 47 48+@pytest.mark.skip(reason='empty $PATH has no effect') 49 @pytest.mark.usefixtures('empty_path') 50 def test_pipe_missing_executable(): 51 with pytest.raises(ExecutableNotFound, match=r'execute'): 52@@ -143,7 +145,7 @@ def test_pipe_pipe_invalid_data_mocked(mocker, py2, Popen, quiet): # noqa: N803 53 assert e.value.returncode is mocker.sentinel.returncode 54 assert e.value.stdout is mocker.sentinel.out 55 assert e.value.stderr is err 56- Popen.assert_called_once_with(['dot', '-Tpng'], 57+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpng'], 58 stdin=subprocess.PIPE, 59 stdout=subprocess.PIPE, 60 stderr=subprocess.PIPE, 61@@ -166,7 +168,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet): # noqa: N803 62 63 assert pipe('dot', 'png', b'nongraph', quiet=quiet) is mocker.sentinel.out 64 65- Popen.assert_called_once_with(['dot', '-Tpng'], 66+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpng'], 67 stdin=subprocess.PIPE, 68 stdout=subprocess.PIPE, 69 stderr=subprocess.PIPE, 70@@ -176,6 +178,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet): # noqa: N803 71 assert capsys.readouterr() == ('', '' if quiet else 'stderr') 72 73 74+@pytest.mark.skip(reason='empty $PATH has no effect') 75 @pytest.mark.usefixtures('empty_path') 76 def test_version_missing_executable(): 77 with pytest.raises(ExecutableNotFound, match=r'execute'): 78@@ -196,7 +199,7 @@ def test_version_parsefail_mocked(mocker, Popen): 79 with pytest.raises(RuntimeError): 80 version() 81 82- Popen.assert_called_once_with(['dot', '-V'], 83+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'], 84 stdout=subprocess.PIPE, 85 stderr=subprocess.STDOUT, 86 startupinfo=mocker.ANY) 87@@ -211,7 +214,7 @@ def test_version_mocked(mocker, Popen): 88 89 assert version() == (1, 2, 3) 90 91- Popen.assert_called_once_with(['dot', '-V'], 92+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'], 93 stdout=subprocess.PIPE, 94 stderr=subprocess.STDOUT, 95 startupinfo=mocker.ANY)