mirror of https://github.com/python/cpython.git
Quick fix for tests that fail on systems with an encoding other
than 'iso8859-1'.
This commit is contained in:
parent
a47337fba5
commit
a36cde4ccc
|
@ -1,4 +1,4 @@
|
||||||
# encoding: iso8859-15
|
# encoding: iso8859-1
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -46,7 +46,7 @@ class ReadTest(unittest.TestCase):
|
||||||
mode = "r:"
|
mode = "r:"
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.tar = tarfile.open(self.tarname, mode=self.mode)
|
self.tar = tarfile.open(self.tarname, mode=self.mode, encoding="iso8859-1")
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.tar.close()
|
self.tar.close()
|
||||||
|
@ -177,7 +177,7 @@ def test_find_members(self):
|
||||||
|
|
||||||
def test_extract_hardlink(self):
|
def test_extract_hardlink(self):
|
||||||
# Test hardlink extraction (e.g. bug #857297).
|
# Test hardlink extraction (e.g. bug #857297).
|
||||||
tar = tarfile.open(tarname, errorlevel=1)
|
tar = tarfile.open(tarname, errorlevel=1, encoding="iso8859-1")
|
||||||
|
|
||||||
tar.extract("ustar/regtype", TEMPDIR)
|
tar.extract("ustar/regtype", TEMPDIR)
|
||||||
try:
|
try:
|
||||||
|
@ -216,7 +216,7 @@ def test_provoke_stream_error(self):
|
||||||
self.assertRaises(tarfile.StreamError, f.read)
|
self.assertRaises(tarfile.StreamError, f.read)
|
||||||
|
|
||||||
def test_compare_members(self):
|
def test_compare_members(self):
|
||||||
tar1 = tarfile.open(tarname)
|
tar1 = tarfile.open(tarname, encoding="iso8859-1")
|
||||||
tar2 = self.tar
|
tar2 = self.tar
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
@ -363,6 +363,7 @@ def test_find_regtype_oldv7(self):
|
||||||
self._test_member(tarinfo, size=7011, chksum=md5_regtype)
|
self._test_member(tarinfo, size=7011, chksum=md5_regtype)
|
||||||
|
|
||||||
def test_find_pax_umlauts(self):
|
def test_find_pax_umlauts(self):
|
||||||
|
self.tar = tarfile.open(self.tarname, mode=self.mode, encoding="iso8859-1")
|
||||||
tarinfo = self.tar.getmember("pax/umlauts-ÄÖÜäöüß")
|
tarinfo = self.tar.getmember("pax/umlauts-ÄÖÜäöüß")
|
||||||
self._test_member(tarinfo, size=7011, chksum=md5_regtype)
|
self._test_member(tarinfo, size=7011, chksum=md5_regtype)
|
||||||
|
|
||||||
|
@ -414,7 +415,7 @@ class PaxReadTest(ReadTest):
|
||||||
subdir = "pax"
|
subdir = "pax"
|
||||||
|
|
||||||
def test_pax_globheaders(self):
|
def test_pax_globheaders(self):
|
||||||
tar = tarfile.open(tarname)
|
tar = tarfile.open(tarname, encoding="iso8859-1")
|
||||||
tarinfo = tar.getmember("pax/regtype1")
|
tarinfo = tar.getmember("pax/regtype1")
|
||||||
self.assertEqual(tarinfo.uname, "foo")
|
self.assertEqual(tarinfo.uname, "foo")
|
||||||
self.assertEqual(tarinfo.gname, "bar")
|
self.assertEqual(tarinfo.gname, "bar")
|
||||||
|
@ -777,7 +778,7 @@ def _add_testfile(self, fileobj=None):
|
||||||
tar.close()
|
tar.close()
|
||||||
|
|
||||||
def _create_testtar(self, mode="w:"):
|
def _create_testtar(self, mode="w:"):
|
||||||
src = tarfile.open(tarname)
|
src = tarfile.open(tarname, encoding="iso8859-1")
|
||||||
t = src.getmember("ustar/regtype")
|
t = src.getmember("ustar/regtype")
|
||||||
t.name = "foo"
|
t.name = "foo"
|
||||||
f = src.extractfile(t)
|
f = src.extractfile(t)
|
||||||
|
|
Loading…
Reference in New Issue