]> granicus.if.org Git - python/commitdiff
Removed reliance on damaged module object appearing in sys.modules
authorTim Peters <tim.peters@gmail.com>
Mon, 2 Aug 2004 03:59:57 +0000 (03:59 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 2 Aug 2004 03:59:57 +0000 (03:59 +0000)
after a failed import.

This is the last checkin in the "change import failure semantics" series.

Lib/test/test_pkgimport.py

index 1343173cc9e569dfa0a69ce85882b8dd3543d77e..c87c342b75cb31f278157c411f38b50018d83fda 100644 (file)
@@ -66,12 +66,11 @@ class TestImport(unittest.TestCase):
         try: __import__(self.module_name)
         except NameError: pass
         else: raise RuntimeError, 'Failed to induce NameError.'
-        module = __import__(self.module_name).foo
 
         # ...now  change  the module  so  that  the NameError  doesn't
         # happen
         self.rewrite_file('%s = 1' % var)
-        reload(module)
+        module = __import__(self.module_name).foo
         self.assertEqual(getattr(module, var), 1)