[Zope-CVS] CVS: Packages/autotester - README.txt:1.4 autotest.py:1.6

Chris Withers chrisw at nipltd.com
Fri Sep 26 08:15:27 EDT 2003


Update of /cvs-repository/Packages/autotester
In directory cvs.zope.org:/tmp/cvs-serv4932/autotester

Modified Files:
	README.txt autotest.py 
Log Message:
Added the ability to run a specific clump of unit tests.

=== Packages/autotester/README.txt 1.3 => 1.4 ===
--- Packages/autotester/README.txt:1.3	Fri Sep 26 06:30:06 2003
+++ Packages/autotester/README.txt	Fri Sep 26 08:15:27 2003
@@ -55,7 +55,7 @@
 
 autotest.py currently supports the following command line options:
 
- -t --testing
+ -t, --testing
 
    This prevents emails from being sent and instead sends output
    to stdout. 
@@ -63,6 +63,16 @@
    In addition, output will be written to the console while the 
    script runs.
 
+ -u, --unit [unitname]
+
+   This runs only tests in the specified unit.
+  
+   [unitname] is the lowercase version of the name supplied
+   in the unit directive.
+
+   eg:
+   
+   For <unit XyZ/>, [unitname] is xyz
 
 Credits
 -------


=== Packages/autotester/autotest.py 1.5 => 1.6 ===
--- Packages/autotester/autotest.py:1.5	Fri Sep 26 07:15:02 2003
+++ Packages/autotester/autotest.py	Fri Sep 26 08:15:27 2003
@@ -230,11 +230,14 @@
     if args is None:
         args = sys.argv[1:]
 
-    opts, args = getopt.getopt(args, "t", ["testing"])
+    unitname = None
+    opts, args = getopt.getopt(args, "tu:", ["testing","unit="])
     for opt, val in opts:
         if opt in ("-t", "--testing"):
             TESTING = True
-
+        if opt in ("-u", "--unit"):
+            unitname = val
+            
     if len(args) > 1:
         print >>sys.stderr, "Too many command line arguments!"
         sys.exit(2)
@@ -249,12 +252,18 @@
     schema = ZConfig.loadSchema(schemapath)
     config, _ = ZConfig.loadConfig(schema, configpath)
 
+    found = 0
     for u in config.units:
-        if not u.log:
-            u.log = default_logfile
-        u.email = merge_email(config.email, u.email)
-        Test(u).go()
+        
+        if not unitname or (u.getSectionName()==unitname):
+            found = 1
+            if not u.log:
+                u.log = default_logfile
+            u.email = merge_email(config.email, u.email)
+            Test(u).go()
 
+    if not found:
+        print >>sys.stderr, "unit '%s' could not be found!" % unitname
 
 if __name__ == "__main__":
     main()




More information about the Zope-CVS mailing list