old_contents: import os
  import random
  import tempfile
  from hashlib import md5
  
  import numpy as np
  from astropy.wcs import WCS
  from astropy.io import fits
  
  from .. import mosaic
  
  
  class TestMosaic(object):
  
      def setup_class(self):
  
          random.seed('hello')
          np.random.seed(12345)
  
          w = WCS(naxis=2)
  
          lon = np.linspace(10., 11., 5)
          lat = np.linspace(20., 21., 5)
  
          self.tmpdir = tempfile.mkdtemp()
          os.mkdir(os.path.join(self.tmpdir, 'raw'))
  
          for i in range(len(lon)):
              for j in range(len(lat)):
  
                  w.wcs.crpix = [50.5, 50.5]
                  w.wcs.cdelt = np.array([-0.0066667, 0.0066667])
                  w.wcs.crval = [lon[i], lat[j]]
                  w.wcs.ctype = ["RA---TAN", "DEC--TAN"]
                  w.wcs.crota = [0, random.uniform(0., 360.)]
  
                  header = w.to_header()
  
                  hdu = fits.PrimaryHDU(header=header)
                  hdu.data = np.random.random((100,100))
                  hdu.writeto(os.path.join(self.tmpdir, 'raw', 'test_{0:02d}_{1:02d}.fits'.format(i, j)), clobber=True)
  
      def test_mosaic(self):
          mosaic(os.path.join(self.tmpdir, 'raw'),os.path.join(self.tmpdir, 'mosaic'))
          hdu = fits.open(os.path.join(self.tmpdir, 'mosaic', 'mosaic.fits'))[0]
          assert md5(hdu.data).hexdigest() == "1ef33fc1bf3062739f65f7cadb47eea9"
  
new_contents: import os
  import random
  import tempfile
  from hashlib import md5
  
  import numpy as np
  from astropy.wcs import WCS
  from astropy.io import fits
  
  from .. import mosaic
  
  
  class TestMosaic(object):
  
      def setup_class(self):
  
          random.seed('hello')
          np.random.seed(12345)
  
          w = WCS(naxis=2)
  
          lon = np.linspace(10., 11., 5)
          lat = np.linspace(20., 21., 5)
  
          self.tmpdir = tempfile.mkdtemp()
          os.mkdir(os.path.join(self.tmpdir, 'raw'))
  
          for i in range(len(lon)):
              for j in range(len(lat)):
  
                  w.wcs.crpix = [50.5, 50.5]
                  w.wcs.cdelt = np.array([-0.0066667, 0.0066667])
                  w.wcs.crval = [lon[i], lat[j]]
                  w.wcs.ctype = [b"RA---TAN", b"DEC--TAN"]
                  w.wcs.crota = [0, random.uniform(0., 360.)]
  
                  header = w.to_header()
  
                  hdu = fits.PrimaryHDU(header=header)
                  hdu.data = np.random.random((100,100))
                  hdu.writeto(os.path.join(self.tmpdir, 'raw', 'test_{0:02d}_{1:02d}.fits'.format(i, j)), clobber=True)
  
      def test_mosaic(self):
          mosaic(os.path.join(self.tmpdir, 'raw'),os.path.join(self.tmpdir, 'mosaic'))
          hdu = fits.open(os.path.join(self.tmpdir, 'mosaic', 'mosaic.fits'))[0]
          assert md5(hdu.data).hexdigest() == "1ef33fc1bf3062739f65f7cadb47eea9"
  
subject: Fix failure with Astropy 0.2.x