Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d0ec0e

Browse files
committed
TST: Correctly skip missing distillers
When a distiller is not found, that step is simply skipped by `_try_distill`, so these tests were not actually skipped as intended.
1 parent 740c5d7 commit 5d0ec0e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@
4040
'eps with usetex'
4141
])
4242
def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
43+
if rcParams.get("ps.usedistiller") == "ghostscript":
44+
try:
45+
mpl._get_executable_info("gs")
46+
except mpl.ExecutableNotFoundError as exc:
47+
pytest.skip(str(exc))
48+
elif rcParams.get("ps.userdistiller") == "xpdf":
49+
try:
50+
mpl._get_executable_info("pdftops")
51+
except mpl.ExecutableNotFoundError as exc:
52+
pytest.skip(str(exc))
53+
4354
mpl.rcParams.update(rcParams)
4455

4556
fig, ax = plt.subplots()
@@ -55,8 +66,6 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
5566
title += " \N{MINUS SIGN}\N{EURO SIGN}"
5667
ax.set_title(title)
5768
allowable_exceptions = []
58-
if rcParams.get("ps.usedistiller"):
59-
allowable_exceptions.append(mpl.ExecutableNotFoundError)
6069
if rcParams.get("text.usetex"):
6170
allowable_exceptions.append(RuntimeError)
6271
if rcParams.get("ps.useafm"):

0 commit comments

Comments
 (0)