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

Tim Peters tim at zope.com
Mon Apr 26 14:48:01 EDT 2004


[Marius Gedminas]
> 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.

It's a miserable thing to do!  I'm surprised it hasn't burned us.

> 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):

Feel encouraged to check that in.  Or do you want me to do it?



More information about the ZODB-Dev mailing list