def get_image_from_plot(file_format='png'): ib = BytesIO() plt = get_plt() plt.savefig(ib, format=file_format) plt.close() ib.seek(0) return ib
def test_get_plt(): """ This test only verifies that code up to the point of plotting with matplotlib works correctly. Tests do not exercise matplotlib. """ with rasterio.open('tests/data/RGB.byte.tif'): try: assert plt == get_plt() except ImportError: pass