'If an exception is raised while L{FilePath.copyTo} is trying to open
source file to read from, the destination file is closed and the
exception is raised to the caller of L{FilePath.copyTo}.'

def test_copyToMissingDestFileClosing(self):

    nosuch = self.path.child('nothere')
    nosuch.isfile = (lambda : True)
    destination = ExplodingFilePath(self.mktemp())
    self.assertRaises(IOError, nosuch.copyTo, destination)
    self.assertTrue(destination.fp.closed)
