On Wed, Nov 2, 2011 at 4:16 PM, Wes McKinney <wesmck...@gmail.com> wrote:
> Hi guys,
>
> Is there a common practice for unit testing code that creates
> matplotlib plots? I'm mainly just interested in code coverage versus
> correctness (making sure the code *works*) for now. I guess one way
> would be to disable the GUI backend so GUI elements don't get created
> (if the user is running the test suite from inside IPython in pylab
> mode, for example). Any tips or pointers to projects that do this
> would be very helpful.

We have a unit testing framework for comparing images against baseline
images using PIL to compare "approximately close" at the rendering
level.  The code lives in matplotlib.testing and is triggered by
matplotlib.test.

It might be heavyweight for what you want, so if all you want to do is
insure "it runs" just create some figures using the agg backend and
call savefig.  You can use the pyplot.switch_backends to switch
backends if you are concerned about a user calling it from ipython in
an interactive session.

JDH

JDH

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to