[CalendarServer-changes] [7127] CalendarServer/branches/users/glyph/oracle/twext/enterprise

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 7 19:02:18 PST 2011


Revision: 7127
          http://trac.macosforge.org/projects/calendarserver/changeset/7127
Author:   glyph at apple.com
Date:     2011-03-07 19:02:18 -0800 (Mon, 07 Mar 2011)
Log Message:
-----------
fix test to cover waiting state as well

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/oracle/twext/enterprise/adbapi2.py
    CalendarServer/branches/users/glyph/oracle/twext/enterprise/test/test_adbapi2.py

Modified: CalendarServer/branches/users/glyph/oracle/twext/enterprise/adbapi2.py
===================================================================
--- CalendarServer/branches/users/glyph/oracle/twext/enterprise/adbapi2.py	2011-03-08 03:02:06 UTC (rev 7126)
+++ CalendarServer/branches/users/glyph/oracle/twext/enterprise/adbapi2.py	2011-03-08 03:02:18 UTC (rev 7127)
@@ -234,8 +234,10 @@
 
     implements(IAsyncTransaction)
 
-    def __init__(self):
+    def __init__(self, pool):
         self._spool = []
+        self.paramstyle = pool.paramstyle
+        self.dialect = pool.dialect
 
 
     def _enspool(self, cmd, a=(), kw={}):
@@ -533,7 +535,7 @@
             self._busy.append(basetxn)
             txn = _SingleTxn(self, basetxn)
         else:
-            txn = _SingleTxn(self, _WaitingTxn())
+            txn = _SingleTxn(self, _WaitingTxn(self))
             self._waiting.append(txn)
             # FIXME/TESTME: should be len(self._busy) + len(self._finishing)
             # (free doesn't need to be considered, as it's tested above)

Modified: CalendarServer/branches/users/glyph/oracle/twext/enterprise/test/test_adbapi2.py
===================================================================
--- CalendarServer/branches/users/glyph/oracle/twext/enterprise/test/test_adbapi2.py	2011-03-08 03:02:06 UTC (rev 7126)
+++ CalendarServer/branches/users/glyph/oracle/twext/enterprise/test/test_adbapi2.py	2011-03-08 03:02:18 UTC (rev 7127)
@@ -664,8 +664,14 @@
         """
         TEST_PARAMSTYLE = "justtesting"
         self.pool.paramstyle = TEST_PARAMSTYLE
-        waittxn = self.pool.connection()
-        self.assertEquals(waittxn.paramstyle, TEST_PARAMSTYLE)
+        normaltxn = self.pool.connection()
+        self.assertEquals(normaltxn.paramstyle, TEST_PARAMSTYLE)
+        self.pauseHolders()
+        extra = []
+        extra.append(self.pool.connection())
+        waitingtxn = self.pool.connection()
+        self.assertEquals(waitingtxn.paramstyle, TEST_PARAMSTYLE)
+        self.flushHolders()
         self.pool.stopService()
         notxn = self.pool.connection()
         self.assertEquals(notxn.paramstyle, TEST_PARAMSTYLE)
@@ -678,8 +684,14 @@
         """
         TEST_DIALECT = "otherdialect"
         self.pool.dialect = TEST_DIALECT
-        waittxn = self.pool.connection()
-        self.assertEquals(waittxn.dialect, TEST_DIALECT)
+        normaltxn = self.pool.connection()
+        self.assertEquals(normaltxn.dialect, TEST_DIALECT)
+        self.pauseHolders()
+        extra = []
+        extra.append(self.pool.connection())
+        waitingtxn = self.pool.connection()
+        self.assertEquals(waitingtxn.dialect, TEST_DIALECT)
+        self.flushHolders()
         self.pool.stopService()
         notxn = self.pool.connection()
         self.assertEquals(notxn.dialect, TEST_DIALECT)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110307/99f3d8b8/attachment.html>


More information about the calendarserver-changes mailing list