Commit d2510a0f authored by Jeremy Hylton's avatar Jeremy Hylton

Install a WarningsHook for checkLocalTransactions.

parent 81e78f9d
...@@ -16,6 +16,7 @@ import unittest ...@@ -16,6 +16,7 @@ import unittest
import ZODB import ZODB
import ZODB.FileStorage import ZODB.FileStorage
from ZODB.POSException import ReadConflictError, ConflictError from ZODB.POSException import ReadConflictError, ConflictError
from ZODB.tests.warnhook import WarningsHook
from persistent import Persistent from persistent import Persistent
from persistent.mapping import PersistentMapping from persistent.mapping import PersistentMapping
...@@ -209,6 +210,8 @@ class ZODBTests(unittest.TestCase): ...@@ -209,6 +210,8 @@ class ZODBTests(unittest.TestCase):
# not the thread. # not the thread.
conn1 = self._db.open() conn1 = self._db.open()
conn2 = self._db.open() conn2 = self._db.open()
hook = WarningsHook()
hook.install()
try: try:
conn1.setLocalTransaction() conn1.setLocalTransaction()
conn2.setLocalTransaction() conn2.setLocalTransaction()
...@@ -238,9 +241,12 @@ class ZODBTests(unittest.TestCase): ...@@ -238,9 +241,12 @@ class ZODBTests(unittest.TestCase):
conn2.sync() conn2.sync()
self.assertEqual(r1['item'], 2) self.assertEqual(r1['item'], 2)
self.assertEqual(r2['item'], 2) self.assertEqual(r2['item'], 2)
for msg, obj, filename, lineno in hook.warnings:
self.assert_(msg.startswith("getTransaction() is deprecated."))
finally: finally:
conn1.close() conn1.close()
conn2.close() conn2.close()
hook.uninstall()
def checkReadConflict(self): def checkReadConflict(self):
self.obj = P() self.obj = P()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment