photutils icon indicating copy to clipboard operation
photutils copied to clipboard

Decorate all doc examples with pytest-mpl

Open bsipocz opened this issue 9 years ago • 7 comments

Change all the doctest-skip of the images, and also change the plot tests to check for the content with pytest-mpl. I plan to do this in the next few weeks, thus assigning myself.

bsipocz avatar Jun 26 '15 12:06 bsipocz

@bsipocz - just a word of advice - for the plot tests, I highly recommend reducing the default figsize to a small value that is large enough that you can see what you are testing but no larger (to keep the size of the reference images from being too large). Usually, something like 3x3 inches will be large enough.

astrofrog avatar Jun 26 '15 12:06 astrofrog

@astrofrog, @larrybradley - Would you prefer to store the plot reference images here in photutils/tests or can I put them to https://github.com/astropy/photutils-datasets and have that either as a test dependency or submodule or similar?

bsipocz avatar Jul 04 '15 23:07 bsipocz

@bsipocz - as long as there are <10, just store them in the repository directly. The difficulty with storing them in an external repository is that you need the versions to match very precisely, and it's not worth the hassle.

astrofrog avatar Jul 05 '15 06:07 astrofrog

(But it's good to make an effort to minimize the size of each plot by reducing the figure size)

astrofrog avatar Jul 05 '15 06:07 astrofrog

I agree that it's better to have them in the repository directly if possible.

larrybradley avatar Jul 06 '15 19:07 larrybradley

@astrofrog - There is a serious issue with this namely that the apertute classes are tested using the @pytest.mark.parametrize decorator. But the decorator doesn't parametrize the argument of another decorator, so I cannot say:

@pytest.mark.skipif('not HAS_MATPLOTLIB')
@pytest.mark.parametrize(('aperture_class', 'params'), TEST_APERTURES)
@pytest.mark.mpl_image_compare(filename='{0}.png'.format(aperture_class), tolerance=1.5)
def test_aperture_plots(aperture_class, params):

Do you know a workaround for this, or should I do the test one by one for the apertures?

bsipocz avatar Aug 28 '15 20:08 bsipocz

@bsipocz I'm not sure - could you open an issue in the pytest-mpl repo and I can take a look at it later this week?

astrofrog avatar Sep 07 '15 14:09 astrofrog