summaryrefslogtreecommitdiff
path: root/Lib/test/test_zipfile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-02-02 17:46:33 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2013-02-02 17:46:33 +0200
commit13e56c73b712b72133e3684bcff9cb1760cc891e (patch)
tree98a2d752dc8ddc7931cc724753fc71f676c393d8 /Lib/test/test_zipfile.py
parentdc6dc4bc3196383db028a365afcf516c835ef999 (diff)
downloadcpython-git-13e56c73b712b72133e3684bcff9cb1760cc891e.tar.gz
Fix the test and remove trailing dots on Windows for issue #6972.
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r--Lib/test/test_zipfile.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 58d3c4883a..f535e56e9b 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -434,8 +434,6 @@ class TestsWithSourceFile(unittest.TestCase):
('/foo/bar', 'foo/bar'),
('/foo/../bar', 'foo/bar'),
('/foo/../../bar', 'foo/bar'),
- ('//foo/bar', 'foo/bar'),
- ('../../foo../../ba..r', 'foo../ba..r'),
]
if os.path.sep == '\\':
hacknames.extend([
@@ -447,16 +445,22 @@ class TestsWithSourceFile(unittest.TestCase):
(r'C:/foo/bar', 'foo/bar'),
(r'C://foo/bar', 'foo/bar'),
(r'C:\foo\bar', 'foo/bar'),
- (r'//conky/mountpoint/foo/bar', 'foo/bar'),
- (r'\\conky\mountpoint\foo\bar', 'foo/bar'),
+ (r'//conky/mountpoint/foo/bar', 'conky/mountpoint/foo/bar'),
+ (r'\\conky\mountpoint\foo\bar', 'conky/mountpoint/foo/bar'),
(r'///conky/mountpoint/foo/bar', 'conky/mountpoint/foo/bar'),
(r'\\\conky\mountpoint\foo\bar', 'conky/mountpoint/foo/bar'),
(r'//conky//mountpoint/foo/bar', 'conky/mountpoint/foo/bar'),
(r'\\conky\\mountpoint\foo\bar', 'conky/mountpoint/foo/bar'),
- (r'//?/C:/foo/bar', 'foo/bar'),
- (r'\\?\C:\foo\bar', 'foo/bar'),
+ (r'//?/C:/foo/bar', '_/C_/foo/bar'),
+ (r'\\?\C:\foo\bar', '_/C_/foo/bar'),
(r'C:/../C:/foo/bar', 'C_/foo/bar'),
(r'a:b\c<d>e|f"g?h*i', 'b/c_d_e_f_g_h_i'),
+ ('../../foo../../ba..r', 'foo/ba..r'),
+ ])
+ else: # Unix
+ hacknames.extend([
+ ('//foo/bar', 'foo/bar'),
+ ('../../foo../../ba..r', 'foo../ba..r'),
])
for arcname, fixedname in hacknames:
@@ -469,7 +473,8 @@ class TestsWithSourceFile(unittest.TestCase):
with zipfile.ZipFile(TESTFN2, 'r') as zipfp:
writtenfile = zipfp.extract(arcname, targetpath)
- self.assertEqual(writtenfile, correctfile)
+ self.assertEqual(writtenfile, correctfile,
+ msg="extract %r" % arcname)
self.check_file(correctfile, content)
shutil.rmtree('target')
@@ -482,7 +487,8 @@ class TestsWithSourceFile(unittest.TestCase):
with zipfile.ZipFile(TESTFN2, 'r') as zipfp:
writtenfile = zipfp.extract(arcname)
- self.assertEqual(writtenfile, correctfile)
+ self.assertEqual(writtenfile, correctfile,
+ msg="extract %r" % arcname)
self.check_file(correctfile, content)
shutil.rmtree(fixedname.split('/')[0])