[Python-checkins] python/dist/src/Lib/test regrtest.py,1.163,1.164

doerwalter at users.sourceforge.net doerwalter at users.sourceforge.net
Fri Nov 12 19:51:41 CET 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8210/Lib/test

Modified Files:
	regrtest.py 
Log Message:
Add options to regrtest.py to make it possible to specify where to put
the coverage files when -T is used.


Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- regrtest.py	31 Aug 2004 13:45:22 -0000	1.163
+++ regrtest.py	12 Nov 2004 18:51:27 -0000	1.164
@@ -20,6 +20,8 @@
 -h: help       -- print this text and exit
 -t: threshold  -- call gc.set_threshold(N)
 -T: coverage   -- turn on code coverage using the trace module
+-D: coverdir   -- Directory where coverage files are put
+-N: nocoverdir -- Put coverage files alongside modules
 -L: runleaks   -- run the leaks(1) command just before exit
 -R: huntrleaks -- search for reference leaks (needs debug build, v. slow)
 
@@ -31,6 +33,10 @@
 
 -T turns on code coverage tracing with the trace module.
 
+-D specifies the directory where coverage files are put.
+
+-N Put coverage files alongside modules.
+
 -s means to run only a single test and exit.  This is useful when
 doing memory analysis on the Python interpreter (which tend to consume
 too many resources to run the full regression test non-stop).  The
@@ -141,8 +147,8 @@
 
 def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
          exclude=False, single=False, randomize=False, fromfile=None,
-         findleaks=False, use_resources=None, trace=False, runleaks=False,
-         huntrleaks=False):
+         findleaks=False, use_resources=None, trace=False, coverdir='coverage',
+         runleaks=False, huntrleaks=False):
     """Execute a test suite.
 
     This also parses command-line options and modifies its behavior
@@ -160,18 +166,19 @@
     files beginning with test_ will be used.
 
     The other default arguments (verbose, quiet, generate, exclude, single,
-    randomize, findleaks, use_resources, and trace) allow programmers calling
-    main() directly to set the values that would normally be set by flags on
-    the command line.
+    randomize, findleaks, use_resources, trace and coverdir) allow programmers
+    calling main() directly to set the values that would normally be set by
+    flags on the command line.
     """
 
     test_support.record_original_stdout(sys.stdout)
     try:
-        opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TLR:',
+        opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:',
                                    ['help', 'verbose', 'quiet', 'generate',
                                     'exclude', 'single', 'random', 'fromfile',
                                     'findleaks', 'use=', 'threshold=', 'trace',
-                                    'runleaks', 'huntrleaks='
+                                    'coverdir=', 'nocoverdir', 'runleaks',
+                                    'huntrleaks='
                                     ])
     except getopt.error, msg:
         usage(2, msg)
@@ -206,6 +213,10 @@
             gc.set_threshold(int(a))
         elif o in ('-T', '--coverage'):
             trace = True
+        elif o in ('-D', '--coverdir'):
+            coverdir = os.path.join(os.getcwd(), a)
+        elif o in ('-N', '--nocoverdir'):
+            coverdir = None
         elif o in ('-R', '--huntrleaks'):
             huntrleaks = a.split(':')
             if len(huntrleaks) != 3:
@@ -304,7 +315,6 @@
         import trace
         tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
                              trace=False, count=True)
-        coverdir = os.path.join(os.getcwd(), 'coverage')
     test_support.verbose = verbose      # Tell tests to be moderately quiet
     test_support.use_resources = use_resources
     save_modules = sys.modules.keys()



More information about the Python-checkins mailing list