Skip to content
Browse files

image comparison decorator: add option to pass kwargs to savefig

  • Loading branch information...
1 parent f68ac89 commit 45fa53d74a3322d6012f6f2af8ee494fbe04516b @jenshnielsen jenshnielsen committed Oct 24, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/matplotlib/testing/decorators.py
View
10 lib/matplotlib/testing/decorators.py
@@ -142,7 +142,10 @@ def do_test():
if self._remove_text:
self.remove_text(figure)
- figure.savefig(actual_fname)
+ if self._savefig_kwarg:
+ figure.savefig(actual_fname, **self._savefig_kwarg)
+ else:
+ figure.savefig(actual_fname)
err = compare_images(expected_fname, actual_fname,
self._tol, in_decorator=True)
@@ -166,7 +169,7 @@ def do_test():
yield (do_test,)
def image_comparison(baseline_images=None, extensions=None, tol=1e-3,
- freetype_version=None, remove_text=False):
+ freetype_version=None, remove_text=False, savefig_kwarg=None):
"""
call signature::
@@ -231,7 +234,8 @@ def compare_images_decorator(func):
'_extensions': extensions,
'_tol': tol,
'_freetype_version': freetype_version,
- '_remove_text': remove_text})
+ '_remove_text': remove_text,
+ '_savefig_kwarg': savefig_kwarg})
return new_class
return compare_images_decorator

0 comments on commit 45fa53d

Please sign in to comment.
Something went wrong with that request. Please try again.