How do you debug when a unittest.TestCase fails?

Jean-Paul Calderone exarkun at
Thu Jul 19 16:13:47 CEST 2007

On Thu, 19 Jul 2007 09:25:50 -0400, "Emin.shopper Martinian.shopper" <emin.shopper at> wrote:
>After poking around the unittest source code, the best solution I could come
>up with was to do
>>>>import unittest; = lambda self,*args,**kw:
>before running my tests. That patches things so that I can use when
>a test fails. Still, that seems like an ugly hack and I would think there is
>a better solution...


It's distributed with Twisted:

I don't use unittest directly very much.  I'm only slightly surprised that
it is doing something which breaks post-morteming.  If you want, you could
probably fix it (probably something related to how it handles exceptions
from test methods) and contribute a patch to Python.


More information about the Python-list mailing list