mardi 20 mars 2018

How to close testing figures matplotlib

I have a series of image comparison tests in a module that I have made. When using pytest I am getting a low memory warning which I am assuming is due to having multiple test images open (20+). How would I go about cleaning these or closing them? Due to the set up of my code fig.close() won't work. I have attached an example of what one of my tests look like below.

    @pytest.mark.mpl_image_compare(baseline_dir='baseline',
                               filename='file.png',
                               style=('style_guidline'),
                               savefig_kwargs={'bbox_inches': 'tight'},
                               tolerance=5)
    def test_3(self):
        data = pd.read_csv('test.csv)
        fig = module.create_figure(
        data=data,
        kind="bar_chart",
        )
        return fig

Aucun commentaire:

Enregistrer un commentaire