Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c7fcc2d

Browse files
committed
Two fixes to make this test pass on MacOS9:
- the test was sloppy about filenames: "0-REGTYPE-TEXT" was used where the archive held "/0-REGTYPE-TEXT". - tarfile extracts all files in binary mode, but the test expected to be able to read and compare text files in text mode. Use universal text mode.
1 parent 834eff6 commit c7fcc2d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/test/test_tarfile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ def test_sparse(self):
7474
"""
7575
if self.sep != "|":
7676
f1 = self.tar.extractfile("S-SPARSE")
77-
f2 = self.tar.extractfile("S-SPARSE-WITH-NULLS")
77+
f2 = self.tar.extractfile("/S-SPARSE-WITH-NULLS")
7878
self.assert_(f1.read() == f2.read(),
7979
"_FileObject failed on sparse file member")
8080

8181
def test_readlines(self):
8282
"""Test readlines() method of _FileObject.
8383
"""
8484
if self.sep != "|":
85-
filename = "0-REGTYPE-TEXT"
85+
filename = "/0-REGTYPE-TEXT"
8686
self.tar.extract(filename, dirname())
87-
lines1 = file(os.path.join(dirname(), filename), "r").readlines()
87+
lines1 = file(os.path.join(dirname(), filename), "rU").readlines()
8888
lines2 = self.tar.extractfile(filename).readlines()
8989
self.assert_(lines1 == lines2,
9090
"_FileObject.readline() does not work correctly")
@@ -93,7 +93,7 @@ def test_seek(self):
9393
"""Test seek() method of _FileObject, incl. random reading.
9494
"""
9595
if self.sep != "|":
96-
filename = "0-REGTYPE"
96+
filename = "/0-REGTYPE"
9797
self.tar.extract(filename, dirname())
9898
data = file(os.path.join(dirname(), filename), "rb").read()
9999

0 commit comments

Comments
 (0)