Skip to content

BUG: fix test error when ghostscript not installed #3312

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
merged 1 commit into from
Jul 27, 2014
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
24 changes: 14 additions & 10 deletions lib/matplotlib/tests/test_backend_ps.py
Original file line number Diff line number Diff line change
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