Skip to content
  • Sponsor matplotlib/matplotlib

  • Notifications You must be signed in to change notification settings
  • Fork 7.9k

Backport PR #26955 on branch v3.8.x (Fix incorrect skip check in test_backend_ps.) #26956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_macosx.py
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ def __init__(self, canvas, num):
icon_path = str(cbook._get_data_path('images/matplotlib.pdf'))
_macosx.FigureManager.set_icon(icon_path)
FigureManagerBase.__init__(self, canvas, num)
self._set_window_mode(mpl.rcParams.get("macosx.window_mode", "system"))
self._set_window_mode(mpl.rcParams["macosx.window_mode"])
if self.toolbar is not None:
self.toolbar.update()
if mpl.is_interactive():
15 changes: 7 additions & 8 deletions lib/matplotlib/tests/test_backend_ps.py
Original file line number Diff line number Diff line change
@@ -40,20 +40,19 @@
'eps with usetex'
])
def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
if rcParams.get("ps.usedistiller") == "ghostscript":
mpl.rcParams.update(rcParams)
if mpl.rcParams["ps.usedistiller"] == "ghostscript":
try:
mpl._get_executable_info("gs")
except mpl.ExecutableNotFoundError as exc:
pytest.skip(str(exc))
elif rcParams.get("ps.userdistiller") == "xpdf":
elif mpl.rcParams["ps.usedistiller"] == "xpdf":
try:
mpl._get_executable_info("gs") # Effectively checks for ps2pdf.
mpl._get_executable_info("pdftops")
except mpl.ExecutableNotFoundError as exc:
pytest.skip(str(exc))

mpl.rcParams.update(rcParams)

fig, ax = plt.subplots()

with io.StringIO() as s_buf, io.BytesIO() as b_buf:
@@ -67,9 +66,9 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
title += " \N{MINUS SIGN}\N{EURO SIGN}"
ax.set_title(title)
allowable_exceptions = []
if rcParams.get("text.usetex"):
if mpl.rcParams["text.usetex"]:
allowable_exceptions.append(RuntimeError)
if rcParams.get("ps.useafm"):
if mpl.rcParams["ps.useafm"]:
allowable_exceptions.append(mpl.MatplotlibDeprecationWarning)
try:
fig.savefig(s_buf, format=format, orientation=orientation,
@@ -87,14 +86,14 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
if format == 'ps':
# Default figsize = (8, 6) inches = (576, 432) points = (203.2, 152.4) mm.
# Landscape orientation will swap dimensions.
if rcParams.get("ps.usedistiller") == "xpdf":
if mpl.rcParams["ps.usedistiller"] == "xpdf":
# Some versions specifically show letter/203x152, but not all,
# so we can only use this simpler test.
if papersize == 'figure':
assert b'letter' not in s_val.lower()
else:
assert b'letter' in s_val.lower()
elif rcParams.get("ps.usedistiller") or rcParams.get("text.usetex"):
elif mpl.rcParams["ps.usedistiller"] or mpl.rcParams["text.usetex"]:
width = b'432.0' if orientation == 'landscape' else b'576.0'
wanted = (b'-dDEVICEWIDTHPOINTS=' + width if papersize == 'figure'
else b'-sPAPERSIZE')