diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-08-16 17:54:28 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-08-16 17:54:28 (GMT) |
commit | 2460a43a6569fbf240c5a72d0b052565617213eb (patch) | |
tree | 13d6ea2138689a623218ec25a80e26d402e7bcd0 /Lib/test | |
parent | 79766636b6fbc7e01af160008df9cd31112716d6 (diff) | |
download | cpython-2460a43a6569fbf240c5a72d0b052565617213eb.zip cpython-2460a43a6569fbf240c5a72d0b052565617213eb.tar.gz cpython-2460a43a6569fbf240c5a72d0b052565617213eb.tar.bz2 |
Issue #9425: read_directory() is fully unicode compliant
zipimport is now able to load a module with an unencodable filename.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_zipimport.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index ba4e34a..61a6c0a 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -382,6 +382,20 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase): files = {TESTMOD + ".py": (NOW, raise_src)} self.doTest(None, files, TESTMOD, call=self.doTraceback) + @unittest.skipIf(support.TESTFN_UNENCODABLE is None, + "need an unencodable filename") + def testUndecodable(self): + filename = support.TESTFN_UNENCODABLE + ".zip" + z = ZipFile(filename, "w") + zinfo = ZipInfo(TESTMOD + ".py", time.localtime(NOW)) + zinfo.compress_type = self.compression + z.writestr(zinfo, test_src) + z.close() + try: + zipimport.zipimporter(filename) + finally: + os.remove(filename) + @unittest.skipUnless(zlib, "requires zlib") class CompressedZipImportTestCase(UncompressedZipImportTestCase): |