[Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.46,1.47 test_support.py,1.26,1.27

Guido van Rossum gvanrossum@users.sourceforge.net
Thu, 06 Sep 2001 09:09:43 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv5225

Modified Files:
	regrtest.py test_support.py 
Log Message:
Two small changes to the resource usage option:

(1) Allow multiple -u options to extend each other (and the initial
    value of use_resources passed into regrtest.main()).

(2) When a test is run stand-alone (not via regrtest.py), needed
    resources are always granted.



Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** regrtest.py	2001/09/05 14:38:48	1.46
--- regrtest.py	2001/09/06 16:09:41	1.47
***************
*** 116,123 ****
              findleaks = 1
          elif o in ('-u', '--use'):
!             use_resources = [x.lower() for x in a.split(',')]
!             for r in use_resources:
                  if r not in ('largefile', 'network'):
                      usage(1, 'Invalid -u/--use option: %s' % a)
      if generate and verbose:
          usage(2, "-g and -v don't go together!")
--- 116,124 ----
              findleaks = 1
          elif o in ('-u', '--use'):
!             u = [x.lower() for x in a.split(',')]
!             for r in u:
                  if r not in ('largefile', 'network'):
                      usage(1, 'Invalid -u/--use option: %s' % a)
+             use_resources.extend(u)
      if generate and verbose:
          usage(2, "-g and -v don't go together!")

Index: test_support.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** test_support.py	2001/08/20 22:29:23	1.26
--- test_support.py	2001/09/06 16:09:41	1.27
***************
*** 21,25 ****
  
  verbose = 1              # Flag set to 0 by regrtest.py
! use_resources = []       # Flag set to [] by regrtest.py
  
  def unload(name):
--- 21,25 ----
  
  verbose = 1              # Flag set to 0 by regrtest.py
! use_resources = None       # Flag set to [] by regrtest.py
  
  def unload(name):
***************
*** 39,43 ****
  
  def requires(resource, msg=None):
!     if resource not in use_resources:
          if msg is None:
              msg = "Use of the `%s' resource not enabled" % resource
--- 39,43 ----
  
  def requires(resource, msg=None):
!     if use_resources is not None and resource not in use_resources:
          if msg is None:
              msg = "Use of the `%s' resource not enabled" % resource