diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-01-08 18:41:40 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-01-08 18:41:40 (GMT) |
commit | 3ddc435af6873c6304058d7bcbcb19ee4fba7781 (patch) | |
tree | c7a03cf0a8b856bae2ebebba55b09f775845c7ca /Lib/test/test_import.py | |
parent | 3194d1454cbc11ec477d83fff3fc749972107d29 (diff) | |
download | cpython-3ddc435af6873c6304058d7bcbcb19ee4fba7781.zip cpython-3ddc435af6873c6304058d7bcbcb19ee4fba7781.tar.gz cpython-3ddc435af6873c6304058d7bcbcb19ee4fba7781.tar.bz2 |
Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r-- | Lib/test/test_import.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 31375dc..5f54b57 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -7,6 +7,7 @@ import sys import py_compile import warnings import marshal +from imp import reload from test.test_support import (unlink, TESTFN, unload, run_unittest, check_warnings, TestFailed, EnvironmentVarGuard) @@ -56,11 +57,10 @@ class ImportTest(unittest.TestCase): f.close() try: - try: - mod = __import__(TESTFN) - except ImportError, err: - self.fail("import from %s failed: %s" % (ext, err)) - + mod = __import__(TESTFN) + except ImportError, err: + self.fail("import from %s failed: %s" % (ext, err)) + else: self.assertEquals(mod.a, a, "module loaded (%s) but contents invalid" % mod) self.assertEquals(mod.b, b, @@ -69,10 +69,9 @@ class ImportTest(unittest.TestCase): os.unlink(source) try: - try: - reload(mod) - except ImportError, err: - self.fail("import from .pyc/.pyo failed: %s" % err) + reload(mod) + except ImportError, err: + self.fail("import from .pyc/.pyo failed: %s" % err) finally: try: os.unlink(pyc) @@ -172,7 +171,7 @@ class ImportTest(unittest.TestCase): def test_failing_import_sticks(self): source = TESTFN + os.extsep + "py" f = open(source, "w") - print >> f, "a = 1/0" + print >> f, "a = 1 // 0" f.close() # New in 2.4, we shouldn't be able to import that no matter how often |