From d2da8d3328cd84573fd259cec553fb8a67815cb8 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 8 Sep 2015 15:51:37 +0100 Subject: [PATCH] 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 --- src/allmydata/test/test_util.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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") -- 2.45.2