[Zodb-checkins] CVS: Zope3/src/transaction/tests - test_txn.py:1.3

Jeremy Hylton jeremy@zope.com
Mon, 10 Mar 2003 14:14:41 -0500


Update of /cvs-repository/Zope3/src/transaction/tests
In directory cvs.zope.org:/tmp/cvs-serv8354/transaction/tests

Modified Files:
	test_txn.py 
Log Message:
Make sure failed commit() calls generate CRITICAL log messages.


=== Zope3/src/transaction/tests/test_txn.py 1.2 => 1.3 ===
--- Zope3/src/transaction/tests/test_txn.py:1.2	Fri Mar  7 18:37:39 2003
+++ Zope3/src/transaction/tests/test_txn.py	Mon Mar 10 14:14:40 2003
@@ -19,6 +19,9 @@
 from transaction.manager import TransactionManager, ThreadedTransactionManager
 from transaction.txn import Status
 
+from zope.testing.loghandler import Handler
+from logging import CRITICAL
+
 class TestDataManager:
 
     def __init__(self, fail=None, vote=True):
@@ -49,9 +52,11 @@
 
     def setUp(self):
         self.manager = self.ManagerFactory()
+        self.handler = Handler(self)
+        self.handler.add("txn")
 
     def tearDown(self):
-        pass
+        self.handler.close()
 
     def testBegin(self):
         txn = self.manager.begin()
@@ -137,6 +142,9 @@
         self.assertRaises(TransactionError, txn.commit)
         self.assertEqual(txn.status(), Status.ABORTED)
         txn.abort()
+        self.handler.assertLogsMessage("Transaction failed during second "
+                                       "phase of two-phase commit",
+                                       level=CRITICAL)
 
 class SimpleTxnTests(BaseTxnTests):