diff options
| author | Senthil Kumaran <orsenthil@gmail.com> | 2010-01-08 19:04:16 (GMT) |
|---|---|---|
| committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-01-08 19:04:16 (GMT) |
| commit | ce8e33a095030e7af94f58f9da196b240bdf0476 (patch) | |
| tree | b0ba50cbb6e85c6be6f6e6a870e4232be50a0f9c /Lib/test/test_import.py | |
| parent | 3ddc435af6873c6304058d7bcbcb19ee4fba7781 (diff) | |
| download | cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.zip cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.tar.gz cpython-ce8e33a095030e7af94f58f9da196b240bdf0476.tar.bz2 | |
Reverting the Revision: 77368. I committed Flox's big patch for tests by
mistake. ( It may come in for sure tough)
Diffstat (limited to 'Lib/test/test_import.py')
| -rw-r--r-- | Lib/test/test_import.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 5f54b57..31375dc 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -7,7 +7,6 @@ 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) @@ -57,10 +56,11 @@ class ImportTest(unittest.TestCase): f.close() try: - mod = __import__(TESTFN) - except ImportError, err: - self.fail("import from %s failed: %s" % (ext, err)) - else: + try: + mod = __import__(TESTFN) + except ImportError, err: + self.fail("import from %s failed: %s" % (ext, err)) + self.assertEquals(mod.a, a, "module loaded (%s) but contents invalid" % mod) self.assertEquals(mod.b, b, @@ -69,9 +69,10 @@ class ImportTest(unittest.TestCase): os.unlink(source) try: - reload(mod) - except ImportError, err: - self.fail("import from .pyc/.pyo failed: %s" % err) + try: + reload(mod) + except ImportError, err: + self.fail("import from .pyc/.pyo failed: %s" % err) finally: try: os.unlink(pyc) @@ -171,7 +172,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 |
