Skip to content

Commit

Permalink
Merge pull request #3312 from matthew-brett/fix-ghostscript-skip
Browse files Browse the repository at this point in the history
BUG: fix test error when ghostscript not installed
  • Loading branch information
tacaswell committed Jul 27, 2014
2 parents e76996f + bd852df commit 3540dff
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/matplotlib/tests/test_backend_ps.py
Expand Up @@ -7,11 +7,20 @@
import re

import six
from nose.plugins.skip import SkipTest

import matplotlib
import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup
from matplotlib.testing.decorators import cleanup, knownfailureif


needs_ghostscript = knownfailureif(
matplotlib.checkdep_ghostscript()[0] is None,
"This test needs a ghostscript installation")


needs_tex = knownfailureif(
not matplotlib.checkdep_tex(),
"This test needs a TeX installation")


def _test_savefig_to_stringio(format='ps'):
Expand Down Expand Up @@ -50,18 +59,15 @@ def test_savefig_to_stringio():


@cleanup
@needs_ghostscript
def test_savefig_to_stringio_with_distiller():
if not matplotlib.checkdep_ghostscript():
raise SkipTest("This test requires a GhostScript installation")
matplotlib.rcParams['ps.usedistiller'] = 'ghostscript'
_test_savefig_to_stringio()


@cleanup
@needs_tex
def test_savefig_to_stringio_with_usetex():
if not matplotlib.checkdep_tex():
raise SkipTest("This test requires a TeX installation")

matplotlib.rcParams['text.latex.unicode'] = True
matplotlib.rcParams['text.usetex'] = True
_test_savefig_to_stringio()
Expand All @@ -73,10 +79,8 @@ def test_savefig_to_stringio_eps():


@cleanup
@needs_tex
def test_savefig_to_stringio_with_usetex_eps():
if not matplotlib.checkdep_tex():
raise SkipTest("This test requires a TeX installation")

matplotlib.rcParams['text.latex.unicode'] = True
matplotlib.rcParams['text.usetex'] = True
_test_savefig_to_stringio(format='eps')
Expand Down

0 comments on commit 3540dff

Please sign in to comment.