mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #9425: read_directory() is fully unicode compliant
zipimport is now able to load a module with an unencodable filename.
This commit is contained in:
parent
79766636b6
commit
2460a43a65
2 changed files with 42 additions and 21 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue