[CalendarServer-changes] [8166] CalendarServer/branches/users/glyph/shared-pool-take2/twext/ enterprise/test/test_adbapi2.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Oct 10 08:04:10 PDT 2011


Revision: 8166
          http://trac.macosforge.org/projects/calendarserver/changeset/8166
Author:   glyph at apple.com
Date:     2011-10-10 08:04:10 -0700 (Mon, 10 Oct 2011)
Log Message:
-----------
Actually test dialect and paramstyle since they should propagate in both cases.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/shared-pool-take2/twext/enterprise/test/test_adbapi2.py

Modified: CalendarServer/branches/users/glyph/shared-pool-take2/twext/enterprise/test/test_adbapi2.py
===================================================================
--- CalendarServer/branches/users/glyph/shared-pool-take2/twext/enterprise/test/test_adbapi2.py	2011-10-10 15:03:55 UTC (rev 8165)
+++ CalendarServer/branches/users/glyph/shared-pool-take2/twext/enterprise/test/test_adbapi2.py	2011-10-10 15:04:10 UTC (rev 8166)
@@ -43,6 +43,7 @@
 from twext.enterprise.adbapi2 import ConnectionPoolConnection
 from twext.enterprise.ienterprise import IAsyncTransaction
 from twext.enterprise.ienterprise import POSTGRES_DIALECT
+from twext.enterprise.ienterprise import ICommandBlock
 from twext.enterprise.adbapi2 import ConnectionPool
 
 
@@ -856,13 +857,20 @@
         self.assertEquals(len(self.factory.connections), 2)
 
 
+    def setParamstyle(self, paramstyle):
+        """
+        Change the paramstyle of the transaction under test.
+        """
+        self.pool.paramstyle = paramstyle
+
+
     def test_propagateParamstyle(self):
         """
         Each different type of L{IAsyncTransaction} relays the C{paramstyle}
         attribute from the L{ConnectionPool}.
         """
         TEST_PARAMSTYLE = "justtesting"
-        self.pool.paramstyle = TEST_PARAMSTYLE
+        self.setParamstyle(TEST_PARAMSTYLE)
         normaltxn = self.createTransaction()
         self.assertEquals(normaltxn.paramstyle, TEST_PARAMSTYLE)
         self.pauseHolders()
@@ -876,13 +884,20 @@
         self.assertEquals(notxn.paramstyle, TEST_PARAMSTYLE)
 
 
+    def setDialect(self, dialect):
+        """
+        Change the dialect of the transaction under test.
+        """
+        self.pool.dialect = dialect
+
+
     def test_propagateDialect(self):
         """
         Each different type of L{IAsyncTransaction} relays the C{dialect}
         attribute from the L{ConnectionPool}.
         """
         TEST_DIALECT = "otherdialect"
-        self.pool.dialect = TEST_DIALECT
+        self.setDialect(TEST_DIALECT)
         normaltxn = self.createTransaction()
         self.assertEquals(normaltxn.dialect, TEST_DIALECT)
         self.pauseHolders()
@@ -1109,6 +1124,7 @@
         txn = self.createTransaction()
         a = self.resultOf(txn.execSQL("a"))
         cb = txn.commandBlock()
+        verifyObject(ICommandBlock, cb)
         b = self.resultOf(cb.execSQL("b"))
         d = self.resultOf(txn.execSQL("d"))
         c = self.resultOf(cb.execSQL("c"))
@@ -1386,17 +1402,23 @@
     interacting with each other.
     """
 
-    # Don't run these tests.
-    def test_propagateDialect(self):
+
+    def setParamstyle(self, paramstyle):
         """
-        Paramstyle and dialect are configured differently for
-        shared-connection-pool transactions.
+        Change the paramstyle on both the pool and the client.
         """
+        super(NetworkedConnectionPoolTests, self).setParamstyle(paramstyle)
+        self.pump.client.paramstyle = paramstyle
 
 
-    test_propagateParamstyle = test_propagateDialect
-    test_propagateParamstyle.skip = test_propagateParamstyle.__doc__.strip()
+    def setDialect(self, dialect):
+        """
+        Change the dialect on both the pool and the client.
+        """
+        super(NetworkedConnectionPoolTests, self).setDialect(dialect)
+        self.pump.client.dialect = dialect
 
+
     def test_newTransaction(self):
         """
         L{ConnectionPoolClient.newTransaction} returns a provider of
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111010/f3c2c75b/attachment.html>


More information about the calendarserver-changes mailing list