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

Jim Fulton jim@zope.com
Tue, 13 May 2003 15:28:18 -0400


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

Modified Files:
	test.py 
Log Message:
Added a --dir option to limit where tests are searched for.  This is 
important when you *really* want to limit the code that gets run.
For example, when refactoring interfaces, I didn't want to see the way
I had broken setups for tests in other packages. I *just* wanted to
run the interface tests.


=== Zope3/test.py 1.57 => 1.58 ===
--- Zope3/test.py:1.57	Fri Apr 18 10:06:54 2003
+++ Zope3/test.py	Tue May 13 15:28:18 2003
@@ -411,7 +411,8 @@
 def find_tests(rx):
     global finder
     finder = TestFileFinder(pathinit.libdir)
-    os.path.walk(pathinit.libdir, finder.visit, rx)
+    walkdir = test_dir or pathinit.libdir
+    os.path.walk(walkdir, finder.visit, rx)
     return finder.files
 
 def package_import(modname):
@@ -606,6 +607,7 @@
     global progress
     global build_inplace
     global functional
+    global test_dir
 
     if argv is None:
         argv = sys.argv
@@ -630,10 +632,12 @@
     timesfn = None
     timetests = 0
     functional = False
+    test_dir = None
 
     try:
         opts, args = getopt.getopt(argv[1:], "a:bBcdDfg:G:hLmprtTuv",
-                                   ["all", "help", "libdir=", "times="])
+                                   ["all", "help", "libdir=", "times=",
+                                    "dir="])
     except getopt.error, msg:
         print msg
         print "Try `python %s -h' for more information." % argv[0]
@@ -698,6 +702,8 @@
             except ValueError:
                 # must be a filename to write
                 timesfn = v
+        elif k == '--dir':
+            test_dir = v
 
     if gcthresh is not None:
         if gcthresh == 0: