[Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.24,1.25

Neil Schemenauer python-dev@python.org
Fri, 22 Sep 2000 08:29:37 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv24226/Lib/test

Modified Files:
	regrtest.py 
Log Message:
- Replace debugleak flag with findleaks flag.  The new SAVEALL GC option is
  used to find cyclic garbage produced by tests.


Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** regrtest.py	2000/08/23 20:34:40	1.24
--- regrtest.py	2000/09/22 15:29:28	1.25
***************
*** 15,19 ****
  -s: single    -- run only a single test (see below)
  -r: random    -- randomize test execution order
! -l: leakdebug -- if cycle garbage collection is enabled, run with DEBUG_LEAK
  --have-resources   -- run tests that require large resources (time/space)
  
--- 15,19 ----
  -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
  --have-resources   -- run tests that require large resources (time/space)
  
***************
*** 42,46 ****
  
  def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
!          exclude=0, single=0, randomize=0, leakdebug=0,
           use_large_resources=0):
      """Execute a test suite.
--- 42,46 ----
  
  def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
!          exclude=0, single=0, randomize=0, findleaks=0,
           use_large_resources=0):
      """Execute a test suite.
***************
*** 61,65 ****
  
      The other seven default arguments (verbose, quiet, generate, exclude,
!     single, randomize, and leakdebug) allow programmers calling main()
      directly to set the values that would normally be set by flags on the
      command line.
--- 61,65 ----
  
      The other seven default arguments (verbose, quiet, generate, exclude,
!     single, randomize, and findleaks) allow programmers calling main()
      directly to set the values that would normally be set by flags on the
      command line.
***************
*** 80,84 ****
          if o == '-s': single = 1
          if o == '-r': randomize = 1
!         if o == '-l': leakdebug = 1
          if o == '--have-resources': use_large_resources = 1
      if generate and verbose:
--- 80,84 ----
          if o == '-s': single = 1
          if o == '-r': randomize = 1
!         if o == '-l': findleaks = 1
          if o == '--have-resources': use_large_resources = 1
      if generate and verbose:
***************
*** 89,99 ****
      skipped = []
  
!     if leakdebug:
          try:
              import gc
          except ImportError:
              print 'cycle garbage collection not available'
          else:
!             gc.set_debug(gc.DEBUG_LEAK)
  
      if single:
--- 89,101 ----
      skipped = []
  
!     if findleaks:
          try:
              import gc
          except ImportError:
              print 'cycle garbage collection not available'
+             findleaks = 0
          else:
!             gc.set_debug(gc.DEBUG_SAVEALL)
!             found_garbage = []
  
      if single:
***************
*** 137,140 ****
--- 139,148 ----
          else:
              skipped.append(test)
+         if findleaks:
+             gc.collect()
+             if gc.garbage:
+                 print "garbage:", repr(gc.garbage)
+                 found_garbage.extend(gc.garbage)
+                 del gc.garbage[:]
          # Unload the newly imported modules (best effort finalization)
          for module in sys.modules.keys():