[ZODB-Dev] Some unit tests leave an unclean transaction

Marius Gedminas mgedmin at b4net.lt
Mon Apr 26 14:44:23 EDT 2004


Some BTree unit tests (BTrees.tests.test_compare.CompareTest) leave the
transaction in an unclean state.  This has not been a problem so far,
but is generally a bad thing to do.  I suggest adding a call to
transaction.abort in tearDown:

--- src/BTrees/tests/test_compare.py    (revision 785)
+++ src/BTrees/tests/test_compare.py    (working copy)
@@ -41,6 +41,7 @@
     def tearDown(self):
         self.assert_(self.bucket._p_changed != 2)
         self.assert_(self.set._p_changed != 2)
+        transaction.abort()

     def assertUE(self, callable, *args):
         self.assertRaises(UnicodeError, callable, *args)


At least one of ZODB doctests (ZODB.tests.test_cache.CacheTests.test_cache)
does the same thing.

Marius Gedminas
-- 
"If we were meant to fly, we wouldn't keep losing our luggage."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20040426/610ce2b7/attachment.bin


More information about the ZODB-Dev mailing list