]> granicus.if.org Git - python/commitdiff
Backport of r74103.
authorBrett Cannon <bcannon@gmail.com>
Mon, 20 Jul 2009 00:19:49 +0000 (00:19 +0000)
committerBrett Cannon <bcannon@gmail.com>
Mon, 20 Jul 2009 00:19:49 +0000 (00:19 +0000)
Lib/importlib/test/source/test_abc_loader.py
Misc/NEWS

index b95db04fd947a3803a23c87131544ce4bdcf7bfe..9acc4ad3a0d9e31acd723da9baa8bfef6874dce0 100644 (file)
@@ -346,20 +346,20 @@ class BadBytecodeFailureTests(unittest.TestCase):
         # A bad magic number should lead to an ImportError.
         name = 'mod'
         bad_magic = b'\x00\x00\x00\x00'
-        mock = PyPycLoaderMock({}, {name: {'path': os.path.join('path', 'to',
-                                                                'mod'),
-                                            'magic': bad_magic}})
+        mock = PyPycLoaderMock({name: None},
+                {name: {'path': os.path.join('path', 'to', 'mod'),
+                        'magic': bad_magic}})
         with util.uncache(name):
             self.assertRaises(ImportError, mock.load_module, name)
 
     def test_bad_bytecode(self):
-        # Bad code object bytecode should elad to an ImportError.
+        # Bad code object bytecode should lead to an ImportError.
         name = 'mod'
-        mock = PyPycLoaderMock({}, {name: {'path': os.path.join('path', 'to',
-                                                                'mod'),
-                                            'bc': b''}})
+        mock = PyPycLoaderMock({name: None},
+                    {name: {'path': os.path.join('path', 'to', 'mod'),
+                            'bc': b''}})
         with util.uncache(name):
-            self.assertRaises(ImportError, mock.load_module, name)
+            self.assertRaises(EOFError, mock.load_module, name)
 
 
 def raise_ImportError(*args, **kwargs):
index 286c9249c94d828e94b30ec0714464a7d16b9476..6aed9597d2bb891547d06128c435b7c3a6c68c6c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -62,6 +62,12 @@ Build
 - Issue 5390: Add uninstall icon independent of whether file
   extensions are installed.
 
+Test
+----
+
+- Fix a test in importlib.test.source.test_abc_loader that was incorrectly
+  testing when a .pyc file lacked an code object bytecode.
+
 
 What's New in Python 3.1?
 =========================