File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ def main(tests=None, testdir=None):
105105 if single :
106106 tests = tests [:1 ]
107107 test_support .verbose = verbose # Tell tests to be moderately quiet
108+ save_modules = sys .modules .keys ()
108109 for test in tests :
109110 if not quiet :
110111 print test
@@ -118,6 +119,10 @@ def main(tests=None, testdir=None):
118119 print "test" , test ,
119120 print "skipped -- an optional feature could not be imported"
120121 skipped .append (test )
122+ # Unload the newly imported modules (best effort finalization)
123+ for module in sys .modules .keys ():
124+ if module not in save_modules :
125+ test_support .unload (module )
121126 if good and not quiet :
122127 if not bad and not skipped and len (good ) > 1 :
123128 print "All" ,
You can’t perform that action at this time.
0 commit comments