[Python-checkins] r75866 - in python/trunk: Lib/test/regrtest.py Makefile.pre.in

georg.brandl python-checkins at python.org
Tue Oct 27 21:52:02 CET 2009


Author: georg.brandl
Date: Tue Oct 27 21:52:02 2009
New Revision: 75866

Log:
Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.

Modified:
   python/trunk/Lib/test/regrtest.py
   python/trunk/Makefile.pre.in

Modified: python/trunk/Lib/test/regrtest.py
==============================================================================
--- python/trunk/Lib/test/regrtest.py	(original)
+++ python/trunk/Lib/test/regrtest.py	Tue Oct 27 21:52:02 2009
@@ -10,6 +10,7 @@
 
 -v: verbose    -- run tests in verbose mode with output to stdout
 -w: verbose2   -- re-run failed tests in verbose mode
+-W: verbose3   -- re-run failed tests in verbose mode immediately
 -q: quiet      -- don't print anything except if a test fails
 -x: exclude    -- arguments are tests to *exclude*
 -s: single     -- run only a single test (see below)
@@ -195,7 +196,7 @@
          exclude=False, single=False, randomize=False, fromfile=None,
          findleaks=False, use_resources=None, trace=False, coverdir='coverage',
          runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
-         random_seed=None, use_mp=None):
+         random_seed=None, use_mp=None, verbose3=False):
     """Execute a test suite.
 
     This also parses command-line options and modifies its behavior
@@ -220,14 +221,12 @@
 
     test_support.record_original_stdout(sys.stdout)
     try:
-        opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsSrf:lu:t:TD:NLR:wM:j:',
-                                   ['help', 'verbose', 'quiet', 'exclude',
-                                    'single', 'slow', 'random', 'fromfile',
-                                    'findleaks', 'use=', 'threshold=', 'trace',
-                                    'coverdir=', 'nocoverdir', 'runleaks',
-                                    'huntrleaks=', 'verbose2', 'memlimit=',
-                                    'randseed=', 'multiprocess=', 'slaveargs=',
-                                    ])
+        opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsSrf:lu:t:TD:NLR:wWM:j:',
+            ['help', 'verbose', 'verbose2', 'verbose3', 'quiet',
+             'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks',
+             'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir',
+             'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=',
+             'multiprocess=', 'slaveargs='])
     except getopt.error, msg:
         usage(2, msg)
 
@@ -243,6 +242,8 @@
             verbose += 1
         elif o in ('-w', '--verbose2'):
             verbose2 = True
+        elif o in ('-W', '--verbose3'):
+            verbose3 = True
         elif o in ('-q', '--quiet'):
             quiet = True;
             verbose = 0
@@ -396,14 +397,17 @@
         test_times.append((test_time, test))
         if ok > 0:
             good.append(test)
+            return 'good'
         elif -2 < ok <= 0:
             bad.append(test)
             if ok == -1:
                 environment_changed.append(test)
+            return 'bad'
         else:
             skipped.append(test)
             if ok == -3:
                 resource_denieds.append(test)
+            return 'skipped'
 
     if use_mp:
         from threading import Thread
@@ -479,7 +483,10 @@
                 try:
                     result = runtest(test, verbose, quiet,
                                      testdir, huntrleaks)
-                    accumulate_result(test, result)
+                    which = accumulate_result(test, result)
+                    if verbose3 and which == 'bad':
+                        print "Re-running test %r in verbose mode" % test
+                        runtest(test, True, quiet, testdir, huntrleaks)
                 except KeyboardInterrupt:
                     # print a newline separate from the ^C
                     print

Modified: python/trunk/Makefile.pre.in
==============================================================================
--- python/trunk/Makefile.pre.in	(original)
+++ python/trunk/Makefile.pre.in	Tue Oct 27 21:52:02 2009
@@ -716,7 +716,7 @@
 		- at if which pybuildbot.identify >/dev/null 2>&1; then \
 			pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
 		fi
-		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
+		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rwW
 
 QUICKTESTOPTS=	$(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
 		test_multibytecodec test_urllib2_localnet test_itertools \


More information about the Python-checkins mailing list