[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/tests/test.py Added -N/--repeat option to repeat tests some number of times

Jim Fulton jim at zope.com
Thu Jul 1 15:01:31 EDT 2004


Log message for revision 26021:
Added -N/--repeat option to repeat tests some number of times

This is a bit more convenient than running tests forever. :)



-=-
Modified: Zope3/trunk/src/zope/app/tests/test.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/test.py	2004-07-01 18:58:20 UTC (rev 26020)
+++ Zope3/trunk/src/zope/app/tests/test.py	2004-07-01 19:01:31 UTC (rev 26021)
@@ -127,6 +127,10 @@
     Keep running the selected tests in a loop.  You may experience
     memory leakage.
 
+-N n
+--repeat n
+    Run the selected tests n times.
+
 -m
 -M  minimal GUI. See -U.
 
@@ -776,12 +780,19 @@
         if REFCOUNT:
             rc = sys.gettotalrefcount()
             track = TrackRefs()
-        while True:
+
+        n = LOOP
+        i = 1
+        while i <= n:
+            print
+            print "Run %s:" % i
+            i += 1;
             runner(files, test_filter, DEBUG)
             gc.collect()
             if gc.garbage:
                 print "GARBAGE:", len(gc.garbage), gc.garbage
                 return
+
             if REFCOUNT:
                 prev = rc
                 rc = sys.gettotalrefcount()
@@ -860,7 +871,7 @@
     MODULE_FILTER = None
     TEST_FILTER = None
     VERBOSE = 0
-    LOOP = False
+    LOOP = 0
     GUI = False
     TRACE = False
     REFCOUNT = False
@@ -891,7 +902,8 @@
 
 
     try:
-        opts, args = getopt.getopt(argv[1:], "a:bBcdDfFg:G:hkl:LmMPprs:tTuUv",
+        opts, args = getopt.getopt(argv[1:],
+                                   "a:bBcdDfFg:G:hkl:LmMPprs:tTuUvN:",
                                    ["all", "help", "libdir=", "times=",
                                     "keepbytecode", "dir=", "build",
                                     "build-inplace",
@@ -900,7 +912,7 @@
                                     "gc-threshold=", "gc-option=",
                                     "loop", "gui", "minimal-gui",
                                     "profile", "progress", "refcount", "trace",
-                                    "top-fifty", "verbose",
+                                    "top-fifty", "verbose", "repeat="
                                     ])
     # fixme: add the long names
     # fixme: add the extra documentation
@@ -951,7 +963,9 @@
         elif k in ('-l', '--libdir'):
             LIBDIR = v
         elif k in ("-L", "--loop"):
-            LOOP = 1
+            LOOP = 1000000000
+        elif k in ("-N", "--repeat"):
+            LOOP = int(v)
         elif k == "-m":
             GUI = "minimal"
             msg = "Use -M or --minimal-gui instead of -m."



More information about the Zope3-Checkins mailing list