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.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to