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

Jim Fulton jim@zope.com
Wed, 30 Jul 2003 10:34:40 -0400


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

Modified Files:
	test.py 
Log Message:
Added an error check for bad paths given to --dir.

Also added code to try to prepend src (actually the base lib path)
to the --dir argument if it doesn't exist.


=== Zope3/test.py 1.68 => 1.69 ===
--- Zope3/test.py:1.68	Tue Jul 22 04:06:46 2003
+++ Zope3/test.py	Wed Jul 30 10:34:34 2003
@@ -449,9 +449,30 @@
             if os.path.isdir(name):
                 walk_with_symlinks(name, func, arg)
 
+
+def check_test_dir():
+    global test_dir
+    if test_dir and not os.path.exists(test_dir):
+        d = pathinit.libdir
+        d = os.path.join(d, test_dir)
+        if os.path.exists(d):
+            if not os.path.isdir(d):
+                raise ValueError(
+                    "%s does not exist and %s is not a directory"
+                    % (test_dir, d)
+                    )
+            test_dir = d
+        else:
+            raise ValueError("%s does not exist!" % test_dir)
+
+    print "test_dir", test_dir
+    
+
 def find_tests(rx):
     global finder
     finder = TestFileFinder(pathinit.libdir)
+
+    check_test_dir()
     walkdir = test_dir or pathinit.libdir
     walk_with_symlinks(walkdir, finder.visit, rx)
     return finder.files