]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
fileutil cleanup: delete the unused open_or_create function.
authorDaira Hopwood <daira@jacaranda.org>
Mon, 25 Aug 2014 17:24:59 +0000 (18:24 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Thu, 29 Jan 2015 18:19:57 +0000 (18:19 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/test/test_util.py
src/allmydata/util/fileutil.py

index 2a5ba19978b5eb5e5f1f78735dcf29a92a3cf179..20f157b946b27f6bbee43fd34d2eb707cb30eaf4 100644 (file)
@@ -429,22 +429,6 @@ class FileUtil(unittest.TestCase):
         fileutil.write_atomically(fn, "two", mode="") # non-binary
         self.failUnlessEqual(fileutil.read(fn), "two")
 
-    def test_open_or_create(self):
-        basedir = "util/FileUtil/test_open_or_create"
-        fileutil.make_dirs(basedir)
-        fn = os.path.join(basedir, "here")
-        f = fileutil.open_or_create(fn)
-        f.write("stuff.")
-        f.close()
-        f = fileutil.open_or_create(fn)
-        f.seek(0, os.SEEK_END)
-        f.write("more.")
-        f.close()
-        f = open(fn, "r")
-        data = f.read()
-        f.close()
-        self.failUnlessEqual(data, "stuff.more.")
-
     def test_NamedTemporaryDirectory(self):
         basedir = "util/FileUtil/test_NamedTemporaryDirectory"
         fileutil.make_dirs(basedir)
index 8eb8e9fb6cd360a74fdc4c62147bc0fd0b98df09..9446a3f6a99888d5ea84507fb74d5da6564ebb84 100644 (file)
@@ -224,12 +224,6 @@ def remove_if_possible(f):
     except:
         pass
 
-def open_or_create(fname, binarymode=True):
-    try:
-        return open(fname, binarymode and "r+b" or "r+")
-    except EnvironmentError:
-        return open(fname, binarymode and "w+b" or "w+")
-
 def du(basedir):
     size = 0