'Test that trying to open a non-existent file results in an
IOError (and not some other arbitrary exception).'

def test_open_nonexistent(self):

    try:
        fits.open(self.temp('foobar.fits'))
    except IOError as e:
        assert ('No    such    file    or    directory' in str(e))
    for mode in ('ostream', 'append'):
        with fits.open(self.temp('foobar.fits'), mode=mode) as h:
            pass
        assert os.path.exists(self.temp('foobar.fits'))
        os.remove(self.temp('foobar.fits'))
