]> granicus.if.org Git - python/commitdiff
Make test_runpy re-entrant.
authorBrett Cannon <bcannon@gmail.com>
Thu, 23 Aug 2007 14:53:17 +0000 (14:53 +0000)
committerBrett Cannon <bcannon@gmail.com>
Thu, 23 Aug 2007 14:53:17 +0000 (14:53 +0000)
Lib/test/test_runpy.py
Misc/NEWS

index 3a5a70963bad2363ca2aba5aaccf45424dda4ada..7076df7966500ee11f7e2a68cee966b9a048d742 100644 (file)
@@ -4,7 +4,7 @@ import os
 import os.path
 import sys
 import tempfile
-from test.test_support import verbose, run_unittest
+from test.test_support import verbose, run_unittest, forget
 from runpy import _run_module_code, run_module
 
 # Set up the test code and expected results
@@ -156,6 +156,7 @@ class RunModuleTest(unittest.TestCase):
     def _check_module(self, depth):
         pkg_dir, mod_fname, mod_name = (
                self._make_pkg("x=1\n", depth))
+        forget(mod_name)
         try:
             if verbose: print "Running from source:", mod_name
             d1 = run_module(mod_name) # Read from source
index a04b2bfd1b7c87a0dfbc08004485f5c4bf9fe5cd..228256e915a9da8572024a8d2a219421955fa45d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -832,6 +832,10 @@ Extension Modules
 Tests
 -----
 
+- Make test_runpy reentrant by fixing _check_module to clear out any module
+  being tested.  Was causing an error by __import__ doing a reload on the
+  second run and thus suppressing bytecode recreation.
+
 - Capture socket connection resets and timeouts in test_socket_ssl and
   test_urllib2net and raise test.test_support.ResourceDenied.