[Python-checkins] r57320 - in python/trunk: Lib/test/test_runpy.py Misc/NEWS

brett.cannon python-checkins at python.org
Thu Aug 23 16:53:18 CEST 2007


Author: brett.cannon
Date: Thu Aug 23 16:53:17 2007
New Revision: 57320

Modified:
   python/trunk/Lib/test/test_runpy.py
   python/trunk/Misc/NEWS
Log:
Make test_runpy re-entrant.


Modified: python/trunk/Lib/test/test_runpy.py
==============================================================================
--- python/trunk/Lib/test/test_runpy.py	(original)
+++ python/trunk/Lib/test/test_runpy.py	Thu Aug 23 16:53:17 2007
@@ -4,7 +4,7 @@
 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 @@
     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

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Thu Aug 23 16:53:17 2007
@@ -832,6 +832,10 @@
 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.
 


More information about the Python-checkins mailing list