[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/tests/test.py Merged from trunk 26021:

Jim Fulton jim at zope.com
Fri Jul 2 18:30:10 EDT 2004


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

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



-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/tests/test.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/tests/test.py	2004-07-02 22:28:46 UTC (rev 26081)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/tests/test.py	2004-07-02 22:30:10 UTC (rev 26082)
@@ -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.
 
@@ -780,12 +784,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()
@@ -864,7 +875,7 @@
     MODULE_FILTERS = []
     TEST_FILTERS = []
     VERBOSE = 0
-    LOOP = False
+    LOOP = 0
     GUI = False
     TRACE = False
     REFCOUNT = False
@@ -895,7 +906,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",
@@ -905,7 +917,7 @@
                                     "loop", "gui", "minimal-gui",
                                     "method=", "module=",
                                     "profile", "progress", "refcount", "trace",
-                                    "top-fifty", "verbose",
+                                    "top-fifty", "verbose", "repeat="
                                     ])
     # fixme: add the long names
     # fixme: add the extra documentation
@@ -956,7 +968,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