mirror of
https://github.com/python/cpython.git
synced 2025-12-09 02:35:14 +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)
|
try: __import__(self.module_name)
|
||||||
except NameError: pass
|
except NameError: pass
|
||||||
else: raise RuntimeError, 'Failed to induce NameError.'
|
else: raise RuntimeError, 'Failed to induce NameError.'
|
||||||
module = __import__(self.module_name).foo
|
|
||||||
|
|
||||||
# ...now change the module so that the NameError doesn't
|
# ...now change the module so that the NameError doesn't
|
||||||
# happen
|
# happen
|
||||||
self.rewrite_file('%s = 1' % var)
|
self.rewrite_file('%s = 1' % var)
|
||||||
reload(module)
|
module = __import__(self.module_name).foo
|
||||||
self.assertEqual(getattr(module, var), 1)
|
self.assertEqual(getattr(module, var), 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue