How do you debug when a unittest.TestCase fails?
Jean-Paul Calderone
exarkun at divmod.com
Thu Jul 19 10:13:47 EDT 2007
On Thu, 19 Jul 2007 09:25:50 -0400, "Emin.shopper Martinian.shopper" <emin.shopper at gmail.com> wrote:
>After poking around the unittest source code, the best solution I could come
>up with was to do
>>>>import unittest; unittest.TestCase.run = lambda self,*args,**kw:
>unittest.TestCase.debug(self)
>
>before running my tests. That patches things so that I can use pdb.pm() when
>a test fails. Still, that seems like an ugly hack and I would think there is
>a better solution...
trial:
http://twistedmatrix.com/trac/wiki/TwistedTrial
It's distributed with Twisted:
http://twistedmatrix.com/trac/wiki/Downloads
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.
Jean-Paul
More information about the Python-list
mailing list