summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2000-10-13 01:32:42 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2000-10-13 01:32:42 (GMT)
commit8a00abc0ff6544a7004a86b4c96e23ca23ac66dc (patch)
tree1102ee636085247555913654b96501bea4688b10 /Lib/test/regrtest.py
parent1ea894949f0611fda7b737105406f7f7356018bb (diff)
downloadcpython-8a00abc0ff6544a7004a86b4c96e23ca23ac66dc.zip
cpython-8a00abc0ff6544a7004a86b4c96e23ca23ac66dc.tar.gz
cpython-8a00abc0ff6544a7004a86b4c96e23ca23ac66dc.tar.bz2
Make the regrtest.py -l (findleaks) option considerably less obnoxious.
First, only report garbage that the GC cannot free. Second, only report the number of objects found, not their repr(). People can dig deeper on their own if they find a leak.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index b78800a7..d392e6c 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -14,7 +14,7 @@ Command line options:
-x: exclude -- arguments are tests to *exclude*
-s: single -- run only a single test (see below)
-r: random -- randomize test execution order
--l: findleaks -- if GC is available detect and print cyclic garbage
+-l: findleaks -- if GC is available detect tests that leak memory
--have-resources -- run tests that require large resources (time/space)
If non-option arguments are present, they are names for tests to run,
@@ -92,10 +92,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
try:
import gc
except ImportError:
- print 'cycle garbage collection not available'
+ print 'No GC available, disabling findleaks.'
findleaks = 0
else:
- gc.set_debug(gc.DEBUG_SAVEALL)
+ # Uncomment the line below to report garbage that is not
+ # freeable by reference counting alone. By default only
+ # garbage that is not collectable by the GC is reported.
+ #gc.set_debug(gc.DEBUG_SAVEALL)
found_garbage = []
if single:
@@ -141,7 +144,10 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
if findleaks:
gc.collect()
if gc.garbage:
- print "garbage:", repr(gc.garbage)
+ print "Warning: test created", len(gc.garbage),
+ print "uncollectable object(s)."
+ # move the uncollectable objects somewhere so we don't see
+ # them again
found_garbage.extend(gc.garbage)
del gc.garbage[:]
# Unload the newly imported modules (best effort finalization)