]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Repair test_replace_file for the case where the replaced file did not already exist
authorDaira Hopwood <daira@jacaranda.org>
Tue, 8 Sep 2015 14:51:37 +0000 (15:51 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 30 Sep 2015 15:45:26 +0000 (16:45 +0100)
(which is no longer considered an error).

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/test/test_util.py

index b34d12b0a0f0b5bf6aefbe7ac6ab21ae0a00fc27..d205309cddb5c4d9f64f72e52a8306e963d7a245 100644 (file)
@@ -495,13 +495,14 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
         os.remove(backup_path)
         os.remove(replaced_path)
         fileutil.write(replacement_path, "bar")
-        self.failUnlessRaises(fileutil.ConflictError, fileutil.replace_file, replaced_path, replacement_path, backup_path)
-        self.failUnlessEqual(fileutil.read(replacement_path), "bar")
-        self.failIf(os.path.exists(replaced_path))
+        fileutil.replace_file(replaced_path, replacement_path, backup_path)
+        self.failUnlessEqual(fileutil.read(replaced_path), "bar")
+        self.failIf(os.path.exists(replacement_path))
         self.failIf(os.path.exists(backup_path))
 
         # when replaced, replacement and backup all exist
         fileutil.write(replaced_path,    "foo")
+        fileutil.write(replacement_path, "bar")
         fileutil.write(backup_path,      "bak")
         fileutil.replace_file(replaced_path, replacement_path, backup_path)
         self.failUnlessEqual(fileutil.read(backup_path),   "foo")