[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/rdb/tests/test_zopeconnection.py Merged from Zope X3-3.0 branch:

Jim Fulton jim at zope.com
Thu Sep 2 04:34:53 EDT 2004


Log message for revision 27416:
  Merged from Zope X3-3.0 branch:
  
    r27394 | jim | 2004-09-01 14:58:10 -0400 (Wed, 01 Sep 2004) | 4 lines
  
  Fixed a test that relied on the questionable semantics of
  Transaction.begin.
  


Changed:
  U   Zope3/trunk/src/zope/app/rdb/tests/test_zopeconnection.py


-=-
Modified: Zope3/trunk/src/zope/app/rdb/tests/test_zopeconnection.py
===================================================================
--- Zope3/trunk/src/zope/app/rdb/tests/test_zopeconnection.py	2004-09-02 08:17:38 UTC (rev 27415)
+++ Zope3/trunk/src/zope/app/rdb/tests/test_zopeconnection.py	2004-09-02 08:34:52 UTC (rev 27416)
@@ -16,7 +16,7 @@
 $Id$
 """
 from unittest import TestCase, main, makeSuite
-from transaction import get_transaction
+import transaction
 from zope.app.rdb import ZopeConnection
 from zope.app.rdb.interfaces import IZopeCursor
 from zope.app.rdb.tests.stubs import ConnectionStub, TypeInfoStub
@@ -31,19 +31,17 @@
                         "cursor is not what we expected")
 
     def test_connection_txn_registration(self):
-        t = get_transaction()
-        t.begin()
+        transaction.begin()
 
         zc = ZopeConnection(ConnectionStub(), TypeInfoStub())
         cursor = zc.cursor()
         cursor.execute('select * from blah')
 
         self.assertEqual(zc._txn_registered, True)
-        self.assertEqual(len(t._resources), 1)
+        self.assertEqual(len(transaction.get_transaction()._resources), 1)
 
     def test_commit(self):
-        t = get_transaction()
-        t.begin()
+        transaction.get_transaction().begin()
         zc = ZopeConnection(ConnectionStub(), TypeInfoStub())
         self._txn_registered = True
         zc.commit()
@@ -51,8 +49,7 @@
                          "did not forget the transaction")
 
     def test_rollback(self):
-        t = get_transaction()
-        t.begin()
+        transaction.begin()
         zc = ZopeConnection(ConnectionStub(), TypeInfoStub())
         self._txn_registered = True
         zc.rollback()
@@ -67,7 +64,7 @@
 
     def tearDown(self):
         "Abort the transaction"
-        get_transaction().abort()
+        transaction.abort()
 
 def test_suite():
     return makeSuite(ZopeConnectionTests)



More information about the Zope3-Checkins mailing list