[CalendarServer-changes] [12705] CalDAVTester/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:18:22 PDT 2014


Revision: 12705
          http://trac.calendarserver.org//changeset/12705
Author:   cdaboo at apple.com
Date:     2014-02-14 12:24:02 -0800 (Fri, 14 Feb 2014)
Log Message:
-----------
Add stop on fail option. Define a substitution variable for the current request loop count.

Modified Paths:
--------------
    CalDAVTester/trunk/README.txt
    CalDAVTester/trunk/src/manager.py
    CalDAVTester/trunk/src/request.py

Modified: CalDAVTester/trunk/README.txt
===================================================================
--- CalDAVTester/trunk/README.txt	2014-02-14 20:22:20 UTC (rev 12704)
+++ CalDAVTester/trunk/README.txt	2014-02-14 20:24:02 UTC (rev 12705)
@@ -19,6 +19,7 @@
 	[--all] \
 	[--random] \
 	[--random-seed SEED] \
+	[--stop] \
 	[--print-details-onfail] \
 	[--always-print-request] \
 	[--always-print-response] \
@@ -47,8 +48,10 @@
 
 	--random : randomize the order in which the tests are run.
 	
-	--random-seed SEED : a specific randon seed to use.
+	--random-seed SEED : a specific random seed to use.
 	
+	--stop : stop running all tests after one test file fails.
+
 	--print-details-onfail : print HTTP request/response when a test fails.
 	
 	--always-print-request : always print HTTP request.
@@ -60,9 +63,12 @@
 	--observer OBSEREVER : specify one or more times to change which classes are
 	used to process log and trace messages during a test. The OBSERVER name must
 	be the name of a module in the observers package. The default observer is the
-	"log" observer which produces an output similar to Python unit tests. The
-	"trace" observer produces an output similar to the original output format.
-	The "jsondump" observer prints a JSON representation of the test results.
+	"log" observer. Available observers are:
+		
+		"log" - produces an output similar to Python unit tests.
+		"trace" - produces an output similar to the original output format.
+		"loadfiles" - prints each test file as it is loaded.
+		"jsondump" - prints a JSON representation of the test results.
  
 	file1 file2 ...: a list of test files to execute tests from.
 

Modified: CalDAVTester/trunk/src/manager.py
===================================================================
--- CalDAVTester/trunk/src/manager.py	2014-02-14 20:22:20 UTC (rev 12704)
+++ CalDAVTester/trunk/src/manager.py	2014-02-14 20:24:02 UTC (rev 12705)
@@ -56,6 +56,7 @@
         self.logFile = None
         self.digestCache = {}
         self.postgresLog = ""
+        self.stoponfail = False
         self.print_request = False
         self.print_response = False
         self.print_request_response_on_error = False
@@ -217,6 +218,7 @@
                 "postgres-log=",
                 "random",
                 "random-seed=",
+                "stop",
                 "print-details-onfail",
                 "always-print-request",
                 "always-print-response",
@@ -247,6 +249,8 @@
                 observer_names.append(value)
             elif option == "--postgres-log":
                 self.postgresLog = value
+            elif option == "--stop":
+                self.stoponfail = True
             elif option == "--print-details-onfail":
                 self.print_request_response_on_error = True
             elif option == "--always-print-request":
@@ -292,7 +296,7 @@
             self.randomSeed = random_seed
 
         # Load observers
-        map(lambda name: self.loadObserver(name), observer_names if observer_names else ["loadfiles", "log", ])
+        map(lambda name: self.loadObserver(name), observer_names if observer_names else ["log", ])
 
         self.readXML(sname, fnames, ssl, all)
 
@@ -317,6 +321,9 @@
                 ok += o
                 failed += f
                 ignored += i
+
+                if failed != 0 and self.stoponfail:
+                    break
         except:
             failed += 1
             import traceback

Modified: CalDAVTester/trunk/src/request.py
===================================================================
--- CalDAVTester/trunk/src/request.py	2014-02-14 20:22:20 UTC (rev 12704)
+++ CalDAVTester/trunk/src/request.py	2014-02-14 20:24:02 UTC (rev 12705)
@@ -298,6 +298,7 @@
                 finally:
                     fd.close()
             data = str(self.manager.server_info.subs(data))
+            self.manager.server_info.addextrasubs({"$request_count:": str(self.count)})
             data = self.manager.server_info.extrasubs(data)
             if self.data.generate:
                 if self.data.content_type.startswith("text/calendar"):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/ea7aec4c/attachment.html>


More information about the calendarserver-changes mailing list