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:
Tim Peters 2004-08-02 03:59:57 +00:00
parent 08138fdc7a
commit 99d001ed0d

View file

@ -66,12 +66,11 @@ def test_package_import__semantics(self):
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)