summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 238175f..f3cb464 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -12,15 +12,15 @@ from test import support
# Check for our compression modules.
try:
import gzip
-except ImportError:
+except ModuleNotFoundError:
gzip = None
try:
import bz2
-except ImportError:
+except ModuleNotFoundError:
bz2 = None
try:
import lzma
-except ImportError:
+except ModuleNotFoundError:
lzma = None
def md5sum(data):
@@ -1732,20 +1732,20 @@ class ContextManagerTest(unittest.TestCase):
self.assertTrue(tar.closed, "context manager failed")
def test_closed(self):
- # The __enter__() method is supposed to raise IOError
+ # The __enter__() method is supposed to raise OSError
# if the TarFile object is already closed.
tar = tarfile.open(tarname)
tar.close()
- with self.assertRaises(IOError):
+ with self.assertRaises(OSError):
with tar:
pass
def test_exception(self):
- # Test if the IOError exception is passed through properly.
+ # Test if the OSError exception is passed through properly.
with self.assertRaises(Exception) as exc:
with tarfile.open(tarname) as tar:
- raise IOError
- self.assertIsInstance(exc.exception, IOError,
+ raise OSError
+ self.assertIsInstance(exc.exception, OSError,
"wrong exception raised in context manager")
self.assertTrue(tar.closed, "context manager failed")