Skip to content

Commit

Permalink
Patch by Vladimir Marangozov to unload additionally imported modules
Browse files Browse the repository at this point in the history
after each test has been run.  This avoids excessive memory growth
during the tests.
  • Loading branch information
gvanrossum committed Apr 21, 2000
1 parent cdd092f commit 5796d26
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/test/regrtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down

0 comments on commit 5796d26

Please sign in to comment.