mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Patch by Vladimir Marangozov to unload additionally imported modules
after each test has been run. This avoids excessive memory growth during the tests.
This commit is contained in:
parent
cdd092fe48
commit
5796d26794
1 changed files with 5 additions and 0 deletions
|
|
@ -105,6 +105,7 @@ def main(tests=None, testdir=None):
|
||||||
if single:
|
if single:
|
||||||
tests = tests[:1]
|
tests = tests[:1]
|
||||||
test_support.verbose = verbose # Tell tests to be moderately quiet
|
test_support.verbose = verbose # Tell tests to be moderately quiet
|
||||||
|
save_modules = sys.modules.keys()
|
||||||
for test in tests:
|
for test in tests:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print test
|
print test
|
||||||
|
|
@ -118,6 +119,10 @@ def main(tests=None, testdir=None):
|
||||||
print "test", test,
|
print "test", test,
|
||||||
print "skipped -- an optional feature could not be imported"
|
print "skipped -- an optional feature could not be imported"
|
||||||
skipped.append(test)
|
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 good and not quiet:
|
||||||
if not bad and not skipped and len(good) > 1:
|
if not bad and not skipped and len(good) > 1:
|
||||||
print "All",
|
print "All",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue