Skip to content

PGF backend, fix #1116, #1118 and #1128 #1124

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 6 commits into from
Aug 22, 2012
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
backend_pgf: use SkipTest instead knownfailureif, raise comparison to…
…lerance
  • Loading branch information
pwuertz committed Aug 22, 2012
commit 834faf7be1e95b4fcce30521e5de981d32b372e3
20 changes: 13 additions & 7 deletions lib/matplotlib/tests/test_backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import shutil
import subprocess
import numpy as np
import nose
from nose.plugins.skip import SkipTest
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.testing.compare import compare_images, ImageComparisonFailure
from matplotlib.testing.decorators import _image_directories, knownfailureif
from matplotlib.testing.decorators import _image_directories

baseline_dir, result_dir = _image_directories(lambda: 'dummy func')

Expand All @@ -28,7 +30,6 @@ def check_for(texsystem):
return latex.returncode == 0

def switch_backend(backend):
import nose

def switch_backend_decorator(func):
def backend_switcher(*args, **kwargs):
Expand All @@ -50,7 +51,7 @@ def compare_figure(fname):

expected = os.path.join(result_dir, "expected_%s" % fname)
shutil.copyfile(os.path.join(baseline_dir, fname), expected)
err = compare_images(expected, actual, tol=1e-4)
err = compare_images(expected, actual, tol=5e-3)
if err:
raise ImageComparisonFailure('images not close: %s vs. %s' % (actual, expected))

Expand All @@ -67,9 +68,11 @@ def create_figure():


# test compiling a figure to pdf with xelatex
@knownfailureif(not check_for('xelatex'), msg='xelatex + pgf is required')
@switch_backend('pgf')
def test_xelatex():
if not check_for('xelatex'):
raise SkipTest('xelatex + pgf is required')

rc_xelatex = {'font.family': 'serif',
'pgf.rcfonts': False,}
mpl.rcParams.update(rc_xelatex)
Expand All @@ -78,9 +81,11 @@ def test_xelatex():


# test compiling a figure to pdf with pdflatex
@knownfailureif(not check_for('pdflatex'), msg='pdflatex + pgf is required')
@switch_backend('pgf')
def test_pdflatex():
if not check_for('pdflatex'):
raise SkipTest('pdflatex + pgf is required')

rc_pdflatex = {'font.family': 'serif',
'pgf.rcfonts': False,
'pgf.texsystem': 'pdflatex',
Expand All @@ -92,10 +97,11 @@ def test_pdflatex():


# test updating the rc parameters for each figure
@knownfailureif(not check_for('xelatex') or not check_for('pdflatex'),
msg="xelatex and pdflatex + pgf required")
@switch_backend('pgf')
def test_rcupdate():
if not check_for('xelatex') or not check_for('pdflatex'):
raise SkipTest('xelatex and pdflatex + pgf required')

rc_sets = []
rc_sets.append({'font.family': 'sans-serif',
'font.size': 30,
Expand Down