From: Daira Hopwood Date: Tue, 8 Sep 2015 14:51:37 +0000 (+0100) Subject: Repair test_replace_file for the case where the replaced file did not already exist X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/flags/status?a=commitdiff_plain;h=1122268f0475a65f0fc2aeac051816b286bb0513;p=tahoe-lafs%2Ftahoe-lafs.git Repair test_replace_file for the case where the replaced file did not already exist (which is no longer considered an error). Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/test/test_util.py b/src/allmydata/test/test_util.py index b34d12b0..d205309c 100644 --- a/src/allmydata/test/test_util.py +++ b/src/allmydata/test/test_util.py @@ -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")