[Zope3-checkins] CVS: Zope3 - test.py:1.59

Godefroid Chapelle gotcha@swing.be
Wed, 14 May 2003 05:14:58 -0400


Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv20161

Modified Files:
	test.py 
Log Message:
- doc for the new dir option

- new keepbytecode option : on Cygwin, directory walking is very slow.
  keepbytecode avoids the directory walking to delete bytecode, allowing faster
  tests run while developing


=== Zope3/test.py 1.58 => 1.59 ===
--- Zope3/test.py:1.58	Tue May 13 15:28:18 2003
+++ Zope3/test.py	Wed May 14 05:14:56 2003
@@ -42,6 +42,13 @@
     Unfortunately, the debug harness doesn't print the name of the
     test, so Use With Care.
 
+--dir directory 
+    Option to limit where tests are searched for. This is
+    important when you *really* want to limit the code that gets run.
+    For example, if refactoring interfaces, you don't want to see the way
+    you have broken setups for tests in other packages. You *just* want to
+    run the interface tests.
+
 -D
     Works like -d, except that it loads pdb when an exception occurs.
 
@@ -64,6 +71,9 @@
     (useful for testing components being developed outside the main
     "src" or "build" trees).
 
+--keepbytecode
+    Do not delete all stale bytecode before running tests
+
 -L
     Keep running the selected tests in a loop.  You may experience
     memory leakage.
@@ -541,9 +551,13 @@
                 os.unlink(fullname)
 
 def main(module_filter, test_filter, libdir):
+    if not keepStaleBytecode:
+        os.path.walk(os.curdir, remove_stale_bytecode, None)
+
+    
     global pathinit
 
-    os.path.walk(os.curdir, remove_stale_bytecode, None)
+
 
     # Get the log.ini file from the current directory instead of possibly
     # buried in the build directory.  XXX This isn't perfect because if
@@ -554,6 +568,7 @@
     # Initialize the path and cwd
     pathinit = PathInit(build, build_inplace, libdir)
 
+
     # Initialize the logging module.
     import logging.config
     logging.basicConfig()
@@ -606,6 +621,7 @@
     global timetests
     global progress
     global build_inplace
+    global keepStaleBytecode
     global functional
     global test_dir
 
@@ -631,13 +647,14 @@
     progress = False
     timesfn = None
     timetests = 0
+    keepStaleBytecode = 0
     functional = False
     test_dir = None
 
     try:
         opts, args = getopt.getopt(argv[1:], "a:bBcdDfg:G:hLmprtTuv",
                                    ["all", "help", "libdir=", "times=",
-                                    "dir="])
+                                    "keepbytecode", "dir="])
     except getopt.error, msg:
         print msg
         print "Try `python %s -h' for more information." % argv[0]
@@ -674,6 +691,8 @@
                 print "-G argument must be DEBUG_ flag, not", repr(v)
                 sys.exit(1)
             gcflags.append(v)
+        elif k == '--keepbytecode':
+            keepStaleBytecode = 1
         elif k == '--libdir':
             libdir = v
         elif k == "-L":