mpl_plot_check#

gammapy.utils.testing.mpl_plot_check()[source]#

Matplotlib plotting test context manager.

Create a new figure on __enter__ and calls savefig for the current figure in __exit__. This will trigger a render of the Figure, which can sometimes raise errors if there is a problem.

This is writing to an in-memory byte buffer, i.e. is faster than writing to disk.