[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/ zope.testbrowser changes:

Benji York benji at zope.com
Sat Dec 3 18:06:13 EST 2005


Log message for revision 40521:
  zope.testbrowser changes:
   - switch to time.clock for higher resolution timing
   - fix typo in interface description
   - add new attributes to interface
  

Changed:
  U   Zope3/trunk/src/zope/testbrowser/browser.py
  U   Zope3/trunk/src/zope/testbrowser/interfaces.py

-=-
Modified: Zope3/trunk/src/zope/testbrowser/browser.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/browser.py	2005-12-03 15:44:57 UTC (rev 40520)
+++ Zope3/trunk/src/zope/testbrowser/browser.py	2005-12-03 23:06:12 UTC (rev 40521)
@@ -106,12 +106,12 @@
 
     def start(self):
         """Begin a timing period"""
-        self.start_time = time.time()
+        self.start_time = time.clock()
         self.end_time = None
 
     def stop(self):
         """End a timing period"""
-        self.end_time = time.time()
+        self.end_time = time.clock()
 
     @property
     def elapsedSeconds(self):
@@ -121,7 +121,7 @@
         the end is the current time.
         """
         if self.end_time is None:
-            end_time = time.time()
+            end_time = time.clock()
         else:
             end_time = self.end_time
         return end_time - self.start_time
@@ -218,10 +218,12 @@
 
     @property
     def lastRequestPystones(self):
+        """See zope.testbrowser.interfaces.IBrowser"""
         return self.timer.elapsedPystones
 
     @property
     def lastRequestSeconds(self):
+        """See zope.testbrowser.interfaces.IBrowser"""
         return self.timer.elapsedSeconds
 
     def reload(self):

Modified: Zope3/trunk/src/zope/testbrowser/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/interfaces.py	2005-12-03 15:44:57 UTC (rev 40520)
+++ Zope3/trunk/src/zope/testbrowser/interfaces.py	2005-12-03 23:06:12 UTC (rev 40521)
@@ -40,7 +40,8 @@
 
     headers = schema.Field(
         title=u"Headers",
-        description=u"Heards of the HTTP response; a ``httplib.HTTPMessage``.",
+        description=(u"Headers of the HTTP response; a "
+                     "``httplib.HTTPMessage``."),
         required=True)
 
     contents = schema.Text(
@@ -114,6 +115,26 @@
           o ``id`` -- The id attribute of the anchor tag submit button.
         """
 
+    headers = schema.Field(
+        title=u"lastRequestSeconds",
+        description=(
+        u"""Return how many seconds (or fractions) the last request took.
+
+        The values returned have the same resolution as the results from
+        ``time.clock``.
+        """),
+        required=True)
+
+    headers = schema.Field(
+        title=u"lastRequestPystones",
+        description=(
+        u"""Return how many pystones the last request took.
+
+        This number is found by multiplying the number of pystones/second this
+        system benchmarks at and the result of ``lastRequestSeconds``.
+        """),
+        required=True)
+
     def getControl(label=None, name=None, index=None):
         """Get a control from the page.
 



More information about the Zope3-Checkins mailing list