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
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.
On Wed, Nov 2, 2011 at 4:16 PM, Wes McKinney <wesmckinn@...287...> wrote:
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.