summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-25 14:47:37 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-25 14:47:37 (GMT)
commitf7a17b48d748e1835bcf9df86fb7fb318bb020f8 (patch)
tree403d91c57f72d6e538ce09a8037bd658bc619760 /Lib/test/test_importlib
parent16bdd4120d8452e8e04b124bcdd116608c5166b0 (diff)
downloadcpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.zip
cpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.tar.gz
cpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.tar.bz2
Replace IOError with OSError (#16715)
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/source/test_abc_loader.py14
-rw-r--r--Lib/test/test_importlib/source/test_file_loader.py2
2 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_importlib/source/test_abc_loader.py b/Lib/test/test_importlib/source/test_abc_loader.py
index cce7b07..718a548 100644
--- a/Lib/test/test_importlib/source/test_abc_loader.py
+++ b/Lib/test/test_importlib/source/test_abc_loader.py
@@ -59,7 +59,7 @@ class SourceLoaderMock(SourceOnlyLoaderMock):
elif path == self.bytecode_path:
return self.bytecode
else:
- raise IOError
+ raise OSError
def path_stats(self, path):
assert path == self.path
@@ -125,12 +125,12 @@ class SourceOnlyLoaderTests(SourceLoaderTestHarness):
def test_get_source(self):
# Verify the source code is returned as a string.
- # If an IOError is raised by get_data then raise ImportError.
+ # If an OSError is raised by get_data then raise ImportError.
expected_source = self.loader.source.decode('utf-8')
self.assertEqual(self.loader.get_source(self.name), expected_source)
- def raise_IOError(path):
- raise IOError
- self.loader.get_data = raise_IOError
+ def raise_OSError(path):
+ raise OSError
+ self.loader.get_data = raise_OSError
with self.assertRaises(ImportError) as cm:
self.loader.get_source(self.name)
self.assertEqual(cm.exception.name, self.name)
@@ -216,7 +216,7 @@ class SourceLoaderBytecodeTests(SourceLoaderTestHarness):
# If no bytecode exists then move on to the source.
self.loader.bytecode_path = "<does not exist>"
# Sanity check
- with self.assertRaises(IOError):
+ with self.assertRaises(OSError):
bytecode_path = imp.cache_from_source(self.path)
self.loader.get_data(bytecode_path)
code_object = self.loader.get_code(self.name)
@@ -265,7 +265,7 @@ class SourceLoaderBytecodeTests(SourceLoaderTestHarness):
self.loader.__class__.set_data = original_set_data
def test_set_data_raises_exceptions(self):
- # Raising NotImplementedError or IOError is okay for set_data.
+ # Raising NotImplementedError or OSError is okay for set_data.
def raise_exception(exc):
def closure(*args, **kwargs):
raise exc
diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py
index 90f9d30..dd28e8f 100644
--- a/Lib/test/test_importlib/source/test_file_loader.py
+++ b/Lib/test/test_importlib/source/test_file_loader.py
@@ -407,7 +407,7 @@ class SourceLoaderBadBytecodeTest(BadBytecodeTest):
os.chmod(bytecode_path,
stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
try:
- # Should not raise IOError!
+ # Should not raise OSError!
self.import_(mapping['_temp'], '_temp')
finally:
# Make writable for eventual clean-up.