mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
Removed reliance on damaged module object appearing in sys.modules
after a failed import. This is the last checkin in the "change import failure semantics" series.
This commit is contained in:
parent
08138fdc7a
commit
99d001ed0d
1 changed files with 1 additions and 2 deletions
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue