Description
This was the meat of issue #3152, but there were other failures attached to that ticket, so it got confusing. Reopening with the main issue here:
I'm getting a confusing test error when testing on OSX where ghostscript is not installed.
I am not sure what the right approach is, to avoiding this test when there is no 'gs' binary or equivalent - any advice from the experts?
https://api.travis-ci.org/jobs/28506496/log.txt?deansi=true
======================================================================
ERROR: matplotlib.tests.test_backend_ps.test_savefig_to_stringio_with_distiller
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/nose-1.3.3-py3.3.egg/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/testing/decorators.py", line 110, in wrapped_function
func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/tests/test_backend_ps.py", line 53, in test_savefig_to_stringio_with_distiller
_test_savefig_to_stringio()
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/tests/test_backend_ps.py", line 27, in _test_savefig_to_stringio
plt.savefig(buffer, format=format)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/pyplot.py", line 571, in savefig
res = fig.savefig(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/figure.py", line 1470, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/backend_bases.py", line 2192, in print_figure
**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/backends/backend_ps.py", line 985, in print_ps
return self._print_ps(outfile, 'ps', *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/backends/backend_ps.py", line 1016, in _print_ps
**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/backends/backend_ps.py", line 1218, in _print_figure
gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/backends/backend_ps.py", line 1520, in gs_distill
if ps_backend_helper.supports_ps2write: # gs version >= 9
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/backends/backend_ps.py", line 109, in supports_ps2write
return self.gs_version[0] >= 9
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-macosx-10.6-intel.egg/matplotlib/backends/backend_ps.py", line 99, in gs_version
gs_version = tuple(map(int, ver.strip().split(".")))
ValueError: invalid literal for int() with base 10: ''
The error arises because ver
in the code above is the empty string, and this is so because Popen execute of gs --version
returns the empty string when there there is no gs
binary (around line 93 of lib/matplotlib/backends/backend_ps.py
). I guess this Popen call should raise an error (check of returncode), but I guess we also need to make sure this version check doesn't get called when gs
is not present, and I'm not sure of the cleanest way to achieve that.