Skip to content

Commit 574580c

Browse files
authored
Merge pull request #22791 from anntzer/ce
TST: Tweak _ConverterError reporting in testing
2 parents 33b3015 + 1814f1c commit 574580c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/matplotlib/testing/compare.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _read_until(self, terminator):
9292
while True:
9393
c = self._proc.stdout.read(1)
9494
if not c:
95-
raise _ConverterError
95+
raise _ConverterError(os.fsdecode(bytes(buf)))
9696
buf.extend(c)
9797
if buf.endswith(terminator):
9898
return bytes(buf)
@@ -109,7 +109,8 @@ def __call__(self, orig, dest):
109109
try:
110110
self._read_until(b"\nGS")
111111
except _ConverterError as err:
112-
raise OSError("Failed to start Ghostscript") from err
112+
raise OSError(
113+
"Failed to start Ghostscript:\n\n" + err.args[0]) from None
113114

114115
def encode_and_escape(name):
115116
return (os.fsencode(name)
@@ -172,8 +173,9 @@ def __call__(self, orig, dest):
172173
try:
173174
self._read_until(terminator)
174175
except _ConverterError as err:
175-
raise OSError("Failed to start Inkscape in interactive "
176-
"mode") from err
176+
raise OSError(
177+
"Failed to start Inkscape in interactive mode:\n\n"
178+
+ err.args[0]) from err
177179

178180
# Inkscape's shell mode does not support escaping metacharacters in the
179181
# filename ("\n", and ":;" for inkscape>=1). Avoid any problems by

0 commit comments

Comments
 (0)