'Regression test for https://github.com/astropy/astropy/issues/2794
Ensure files written through gzip are readable.'

def test_write_read_gzip_file(self):

    data = np.arange(100)
    hdu = fits.PrimaryHDU(data=data)
    hdu.writeto(self.temp('test.fits.gz'))
    with open(self.temp('test.fits.gz'), 'rb') as f:
        assert (f.read(3) == GZIP_MAGIC)
    with fits.open(self.temp('test.fits.gz')) as hdul:
        assert np.all((hdul[0].data == data))
