use the "binary" flag on open() for files that shouldn't have line-endings automatically converted

This commit is contained in:
Zooko O'Whielacronx 2007-04-04 16:12:30 -07:00
parent 01502ce665
commit 223bf98992
3 changed files with 5 additions and 5 deletions

View File

@ -565,7 +565,7 @@ class VDrive(unittest.TestCase):
v = self.makeLocalTree("upload") v = self.makeLocalTree("upload")
filename = "upload1" filename = "upload1"
DATA = "here is some data\n" DATA = "here is some data\n"
f = open(filename, "w") f = open(filename, "wb")
f.write(DATA) f.write(DATA)
f.close() f.close()
@ -592,7 +592,7 @@ class VDrive(unittest.TestCase):
def testCHKDirUpload(self): def testCHKDirUpload(self):
DATA = "here is some data\n" DATA = "here is some data\n"
filename = "upload1" filename = "upload1"
f = open(filename, "w") f = open(filename, "wb")
f.write(DATA) f.write(DATA)
f.close() f.close()
@ -624,7 +624,7 @@ class VDrive(unittest.TestCase):
def testCHKDirDelete(self): def testCHKDirDelete(self):
DATA = "here is some data\n" DATA = "here is some data\n"
filename = "upload1" filename = "upload1"
f = open(filename, "w") f = open(filename, "wb")
f.write(DATA) f.write(DATA)
f.close() f.close()

View File

@ -43,7 +43,7 @@ class GoodServer(unittest.TestCase):
def testFilename(self): def testFilename(self):
fn = "Uploader-testFilename.data" fn = "Uploader-testFilename.data"
f = open(fn, "w") f = open(fn, "wb")
data = "This is some data to upload" data = "This is some data to upload"
f.write(data) f.write(data)
f.close() f.close()

View File

@ -28,7 +28,7 @@ class Reuse(unittest.TestCase):
# files in the tmpdir are not: these are either in the process of # files in the tmpdir are not: these are either in the process of
# being added or in the process of being removed. # being added or in the process of being removed.
tmpfile = os.path.join(wq.tmpdir, "foo") tmpfile = os.path.join(wq.tmpdir, "foo")
f = open(tmpfile, "w") f = open(tmpfile, "wb")
f.write("foo") f.write("foo")
f.close() f.close()
# files created with create_tempfile *are* retained, however # files created with create_tempfile *are* retained, however