summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-20 09:52:25 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-20 09:52:25 (GMT)
commitfbd6f9ed124c89753f6e3fd2cd84e4d9c474cc1f (patch)
tree33e90e8c09bd4db6df2c20a82f1a923799b8406f /Lib
parent99953006df1414b048bfc76f66cb36a0fb31a4b7 (diff)
downloadcpython-fbd6f9ed124c89753f6e3fd2cd84e4d9c474cc1f.zip
cpython-fbd6f9ed124c89753f6e3fd2cd84e4d9c474cc1f.tar.gz
cpython-fbd6f9ed124c89753f6e3fd2cd84e4d9c474cc1f.tar.bz2
Issue #23696: Chain ZipImportError to the OSError
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_zipimport.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index 1e351c8..5b8d77c 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -450,7 +450,10 @@ class BadFileZipImportTestCase(unittest.TestCase):
fd = os.open(TESTMOD, os.O_CREAT, 000)
try:
os.close(fd)
- self.assertZipFailure(TESTMOD)
+
+ with self.assertRaises(zipimport.ZipImportError) as cm:
+ zipimport.zipimporter(TESTMOD)
+ self.assertIsInstance(cm.exception.__context__, PermissionError)
finally:
# If we leave "the read-only bit" set on Windows, nothing can
# delete TESTMOD, and later tests suffer bogus failures.