|
From: <as...@us...> - 2009-10-09 17:38:56
|
Revision: 7863
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7863&view=rev
Author: astraw
Date: 2009-10-09 17:38:48 +0000 (Fri, 09 Oct 2009)
Log Message:
-----------
testing: allow limiting the extensions to test on image comparison
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/testing/decorators.py
Modified: trunk/matplotlib/lib/matplotlib/testing/decorators.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009-10-09 17:20:23 UTC (rev 7862)
+++ trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009-10-09 17:38:48 UTC (rev 7863)
@@ -39,23 +39,42 @@
return nose.tools.make_decorator(f)(failer)
return known_fail_decorator
-def image_comparison(baseline_images=None):
+def image_comparison(baseline_images=None,extensions=None):
"""
- compare images generated by the test with those specified in
+ call signature::
+
+ image_comparison(baseline_images=['my_figure'], extensions=None)
+
+ Compare images generated by the test with those specified in
*baseline_images*, which must correspond else an
ImageComparisonFailure exception will be raised.
+
+ Keyword arguments:
+
+ *baseline_images*: list
+ A list of strings specifying the names of the images generated
+ by calls to :meth:`matplotlib.figure.savefig`.
+
+ *extensions*: [ None | list ]
+
+ If *None*, default to all supported extensions.
+
+ Otherwise, a list of extensions to test. For example ['png','pdf'].
"""
if baseline_images is None:
raise ValueError('baseline_images must be specified')
+ if extensions is None:
+ # default extensions to test
+ extensions = ['png', 'pdf']
+
# The multiple layers of defs are required because of how
# parameterized decorators work, and because we want to turn the
# single test_foo function to a generator that generates a
# separate test case for each file format.
def compare_images_decorator(func):
baseline_dir, result_dir = _image_directories(func)
- extensions = ['png', 'pdf']
def compare_images_generator():
for extension in extensions:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|