Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f1b52c4

Browse filesBrowse files
committed
TST: some tex tests also need to guard against missing gs
Also fixed a problem in an error message when bytes were appended to a string (fails on py3.x) by using %. One of the errors before: ====================================================================== ERROR: matplotlib.tests.test_backend_ps.test_savefig_to_stringio_with_usetex ---------------------------------------------------------------------- Traceback (most recent call last): File "lib\site-packages\nose\case.py", line 198, in runTest self.test(*self.arg) File "lib\matplotlib\testing\decorators.py", line 152, in wrapped_callable func(*args, **kwargs) File "lib\matplotlib\testing\decorators.py", line 55, in failer result = f(*args, **kwargs) File "lib\matplotlib\tests\test_backend_ps.py", line 77, in test_savefig_to_stringio_with_usetex _test_savefig_to_stringio() File "lib\matplotlib\tests\test_backend_ps.py", line 40, in _test_savefig_to_stringio fig.savefig(buffer, format=format) File "lib\matplotlib\figure.py", line 1698, in savefig self.canvas.print_figure(*args, **kwargs) File "lib\matplotlib\backend_bases.py", line 2232, in print_figure **kwargs) File "lib\matplotlib\backends\backend_ps.py", line 985, in print_ps return self._print_ps(outfile, 'ps', *args, **kwargs) File "lib\matplotlib\backends\backend_ps.py", line 1012, in _print_ps **kwargs) File "lib\matplotlib\backends\backend_ps.py", line 1376, in _print_figure_tex rotated=psfrag_rotated) File "lib\matplotlib\backends\backend_ps.py", line 1539, in gs_distill raise RuntimeError(m % output) RuntimeError: ghostscript was not able to process your image. Here is the full report generated by ghostscript: b''
1 parent 581c231 commit f1b52c4
Copy full SHA for f1b52c4

File tree

Expand file treeCollapse file tree

2 files changed

+9
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-2
lines changed

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,8 +1530,13 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False):
15301530

15311531
with io.open(outfile, 'rb') as fh:
15321532
if exit_status:
1533-
raise RuntimeError('ghostscript was not able to process \
1534-
your image.\nHere is the full report generated by ghostscript:\n\n' + fh.read())
1533+
output = fh.read()
1534+
m = "\n".join(["ghostscript was not able to process your image.",
1535+
"Here is the full report generated by ghostscript:",
1536+
"",
1537+
"%s"])
1538+
# use % to prevent problems with bytes
1539+
raise RuntimeError(m % output)
15351540
else:
15361541
verbose.report(fh.read(), 'debug')
15371542
os.remove(outfile)

‎lib/matplotlib/tests/test_backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_ps.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_savefig_to_stringio_with_distiller():
7171

7272
@cleanup
7373
@needs_tex
74+
@needs_ghostscript
7475
def test_savefig_to_stringio_with_usetex():
7576
matplotlib.rcParams['text.latex.unicode'] = True
7677
matplotlib.rcParams['text.usetex'] = True
@@ -90,6 +91,7 @@ def test_savefig_to_stringio_eps_afm():
9091

9192
@cleanup
9293
@needs_tex
94+
@needs_ghostscript
9395
def test_savefig_to_stringio_with_usetex_eps():
9496
matplotlib.rcParams['text.latex.unicode'] = True
9597
matplotlib.rcParams['text.usetex'] = True

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.