|
14 | 14 | -x: exclude -- arguments are tests to *exclude* |
15 | 15 | -s: single -- run only a single test (see below) |
16 | 16 | -r: random -- randomize test execution order |
17 | | --l: findleaks -- if GC is available detect and print cyclic garbage |
| 17 | +-l: findleaks -- if GC is available detect tests that leak memory |
18 | 18 | --have-resources -- run tests that require large resources (time/space) |
19 | 19 |
|
20 | 20 | 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, |
92 | 92 | try: |
93 | 93 | import gc |
94 | 94 | except ImportError: |
95 | | - print 'cycle garbage collection not available' |
| 95 | + print 'No GC available, disabling findleaks.' |
96 | 96 | findleaks = 0 |
97 | 97 | else: |
98 | | - gc.set_debug(gc.DEBUG_SAVEALL) |
| 98 | + # Uncomment the line below to report garbage that is not |
| 99 | + # freeable by reference counting alone. By default only |
| 100 | + # garbage that is not collectable by the GC is reported. |
| 101 | + #gc.set_debug(gc.DEBUG_SAVEALL) |
99 | 102 | found_garbage = [] |
100 | 103 |
|
101 | 104 | if single: |
@@ -141,7 +144,10 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, |
141 | 144 | if findleaks: |
142 | 145 | gc.collect() |
143 | 146 | if gc.garbage: |
144 | | - print "garbage:", repr(gc.garbage) |
| 147 | + print "Warning: test created", len(gc.garbage), |
| 148 | + print "uncollectable object(s)." |
| 149 | + # move the uncollectable objects somewhere so we don't see |
| 150 | + # them again |
145 | 151 | found_garbage.extend(gc.garbage) |
146 | 152 | del gc.garbage[:] |
147 | 153 | # Unload the newly imported modules (best effort finalization) |
|
0 commit comments