예제 #1
0
 def test_rename(self):
     """
     Rename a file, copying it across filesystems if need be.
     """
     src = self.path.child('src')
     src.touch()
     dst = self.path.child('dst')
     self.assertTrue(not dst.exists())
     util.rename(src, dst)
     self.assertTrue(dst.exists())
예제 #2
0
    def test_renameOneFileSystem(self):
        """
        Attempting to rename a file across file system boundaries when
        C{oneFileSystem} is C{True} results in
        L{renamer.errors.DifferentLogicalDevices} being raised, assuming the
        current platform doesn't support cross-linking.
        """
        src = self.path.child('src')
        src.touch()
        dst = self.path.child('dst')
        self.assertRaises(
            errors.DifferentLogicalDevices,
            util.rename, src, dst, oneFileSystem=True, renamer=self.exdev)

        self.assertTrue(not dst.exists())
        util.rename(src, dst, oneFileSystem=True)
        self.assertTrue(dst.exists())
예제 #3
0
 def _move(self, src, dst, options):
     self.prepare(dst, options)
     logging.msg('Move: %s => %s' % (src.path, dst.path))
     util.rename(src, dst, oneFileSystem=options['one-file-system'])