[Matplotlib-users] Graphic tests working with single files but not at package level

Thomas Caswell tcaswell at gmail.com
Mon Aug 31 00:51:49 CEST 2015


That is...odd.  Are you being careful to reset any rcparams you change else
where in your test suite?  pyplot has global state and it can leak between
tests.

One very unsatisfying workaround is to use the `remove_text=True` kwarg on
the decorator which will run the image comparisons with out the title.

Tom

On Thu, Aug 20, 2015 at 7:43 AM Fabien <fabien.maussion at gmail.com> wrote:

> Folks,
>
> I have two test files for a small personnal project. Both make use of
> the @image_comparison decorator to compare expected images to the outcome.
>
> When run on single files as follows, everything works fine:
>
> (py2) $ nosetests cleo/tests/test_colors.py
> ..
> ----------------------------------------------------------------------
> Ran 2 tests in 0.414s
>
> OK
> (py2) $ nosetests cleo/tests/test_graphics.py
> .....
> ----------------------------------------------------------------------
> Ran 5 tests in 2.781s
>
> OK
>
> But when I run nose at the package level, I get an error:
>
>
> (py2) $ nosetests .
> ..F....
> ======================================================================
> FAIL: cleo.tests.test_graphics.test_DataLevels_graphics.test
> ----------------------------------------------------------------------
> (...)
> ImageComparisonFailure: images not close:
>
> /home/mowglie/Documents/git/cleo/result_images/test_graphics/test_DataLevels.png
> vs.
>
> /home/mowglie/Documents/git/cleo/result_images/test_graphics/test_DataLevels-expected.png
> (RMS 25.865)
>
> ----------------------------------------------------------------------
> Ran 7 tests in 3.685s
>
> FAILED (failures=1)
>
>
> An inspection of the failing test shows that the title and axis
> characters are slightly shifted, while the image plots (made with
> imshow) look exact same. I am pretty sure that I made no change to
> matplotlib's defaut params or whatsoever. I have the same behavior with
> python 2 and 3.
>
> Any idea what I could have done wrong?
>
> Thanks a lot,
>
> Fabien
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20150830/319c1958/attachment.html>


More information about the Matplotlib-users mailing list