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

Skip to content

Commit b08ab43

Browse files
authored
Merge pull request #16545 from anntzer/xpdftest
Add a smoketest for ps.usedistiller="xpdf".
2 parents 5ea78e1 + 77a1ab1 commit b08ab43

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ steps:
7272
libgirepository-1.0.1 \
7373
lmodern \
7474
fonts-freefont-otf \
75+
poppler-utils \
7576
texlive-pictures \
7677
texlive-fonts-recommended \
7778
texlive-latex-base \

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@
2323
@pytest.mark.parametrize('orientation', ['portrait', 'landscape'])
2424
@pytest.mark.parametrize('format, use_log, rcParams', [
2525
('ps', False, {}),
26-
pytest.param('ps', False, {'ps.usedistiller': 'ghostscript'},
27-
marks=needs_ghostscript),
28-
pytest.param('ps', False, {'text.usetex': True},
29-
marks=[needs_ghostscript, needs_usetex]),
26+
('ps', False, {'ps.usedistiller': 'ghostscript'}),
27+
('ps', False, {'ps.usedistiller': 'xpdf'}),
28+
('ps', False, {'text.usetex': True}),
3029
('eps', False, {}),
3130
('eps', True, {'ps.useafm': True}),
32-
pytest.param('eps', False, {'text.usetex': True},
33-
marks=[needs_ghostscript, needs_usetex]),
31+
('eps', False, {'text.usetex': True}),
3432
], ids=[
3533
'ps',
36-
'ps with distiller',
34+
'ps with distiller=ghostscript',
35+
'ps with distiller=xpdf',
3736
'ps with usetex',
3837
'eps',
3938
'eps afm',
@@ -56,8 +55,16 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation,
5655
if not mpl.rcParams["text.usetex"]:
5756
title += " \N{MINUS SIGN}\N{EURO SIGN}"
5857
ax.set_title(title)
59-
fig.savefig(s_buf, format=format, orientation=orientation)
60-
fig.savefig(b_buf, format=format, orientation=orientation)
58+
allowable_exceptions = []
59+
if rcParams.get("ps.usedistiller"):
60+
allowable_exceptions.append(mpl.ExecutableNotFoundError)
61+
if rcParams.get("text.usetex"):
62+
allowable_exceptions.append(RuntimeError)
63+
try:
64+
fig.savefig(s_buf, format=format, orientation=orientation)
65+
fig.savefig(b_buf, format=format, orientation=orientation)
66+
except tuple(allowable_exceptions) as exc:
67+
pytest.skip(str(exc))
6168

6269
s_val = s_buf.getvalue().encode('ascii')
6370
b_val = b_buf.getvalue()

0 commit comments

Comments
 (0)