From: Brett Cannon Date: Thu, 23 Aug 2007 14:53:17 +0000 (+0000) Subject: Make test_runpy re-entrant. X-Git-Tag: v2.6a1~1461 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbed7a73942c2fb3dbdd2353527bb8c918446cab;p=thirdparty%2FPython%2Fcpython.git Make test_runpy re-entrant. --- diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py index 3a5a70963bad..7076df796650 100644 --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -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 diff --git a/Misc/NEWS b/Misc/NEWS index a04b2bfd1b7c..228256e915a9 100644 --- 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.