summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-04-21 21:35:06 (GMT)
committerGuido van Rossum <guido@python.org>2000-04-21 21:35:06 (GMT)
commit5796d26794eee634a4a06637d99d8d5c58da2bdb (patch)
tree1b2ca7855f3e07b722af5327e60f953e6801fb12
parentcdd092fe4874def51f6a3f9d972bd47588235ce4 (diff)
downloadcpython-5796d26794eee634a4a06637d99d8d5c58da2bdb.zip
cpython-5796d26794eee634a4a06637d99d8d5c58da2bdb.tar.gz
cpython-5796d26794eee634a4a06637d99d8d5c58da2bdb.tar.bz2
Patch by Vladimir Marangozov to unload additionally imported modules
after each test has been run. This avoids excessive memory growth during the tests.
-rwxr-xr-xLib/test/regrtest.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 6364d71..924890a 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -105,6 +105,7 @@ def main(tests=None, testdir=None):
if single:
tests = tests[:1]
test_support.verbose = verbose # Tell tests to be moderately quiet
+ save_modules = sys.modules.keys()
for test in tests:
if not quiet:
print test
@@ -118,6 +119,10 @@ def main(tests=None, testdir=None):
print "test", test,
print "skipped -- an optional feature could not be imported"
skipped.append(test)
+ # Unload the newly imported modules (best effort finalization)
+ for module in sys.modules.keys():
+ if module not in save_modules:
+ test_support.unload(module)
if good and not quiet:
if not bad and not skipped and len(good) > 1:
print "All",