mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 07:06:41 +00:00
fileutil cleanup: delete the unused open_or_create function.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
db12f1cffb
commit
9a401b760e
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user