summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test/frozen/test_loader.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-08-27 23:49:21 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-08-27 23:49:21 (GMT)
commit2153dc001f5565592b44808d7f0f25815010eb9d (patch)
tree8801111b4467bd21f5f936d3fd6196d41f77688f /Lib/importlib/test/frozen/test_loader.py
parentc5951fc996ad74a05e83a61cf0345a4a68c01b12 (diff)
downloadcpython-2153dc001f5565592b44808d7f0f25815010eb9d.zip
cpython-2153dc001f5565592b44808d7f0f25815010eb9d.tar.gz
cpython-2153dc001f5565592b44808d7f0f25815010eb9d.tar.bz2
Move over to using assertRaises as a context manager for importlib tests.
Obviously one shouldn't do whole sale conversions like this, but I was already going through the test code and I was bored at the airport.
Diffstat (limited to 'Lib/importlib/test/frozen/test_loader.py')
-rw-r--r--Lib/importlib/test/frozen/test_loader.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/importlib/test/frozen/test_loader.py b/Lib/importlib/test/frozen/test_loader.py
index fa64f30..c05e22c 100644
--- a/Lib/importlib/test/frozen/test_loader.py
+++ b/Lib/importlib/test/frozen/test_loader.py
@@ -51,8 +51,8 @@ class LoaderTests(abc.LoaderTests):
def test_unloadable(self):
assert machinery.FrozenImporter.find_module('_not_real') is None
- self.assertRaises(ImportError, machinery.FrozenImporter.load_module,
- '_not_real')
+ with self.assertRaises(ImportError):
+ machinery.FrozenImporter.load_module('_not_real')
class InspectLoaderTests(unittest.TestCase):
@@ -84,7 +84,8 @@ class InspectLoaderTests(unittest.TestCase):
# Raise ImportError for modules that are not frozen.
for meth_name in ('get_code', 'get_source', 'is_package'):
method = getattr(machinery.FrozenImporter, meth_name)
- self.assertRaises(ImportError, method, 'importlib')
+ with self.assertRaises(ImportError):
+ method('importlib')
def test_main():