Re: zope.testing.testrunner.debug.post_mortem and try/finally
Marius Gedminas <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Message-ID | <20091202183429.GC10230@platonas> |
On Wed, Dec 02, 2009 at 09:08:51AM -0800, Ross Patterson wrote:
> When a try/finally clause is (appropriately) used to do cleanup after an
> exception during a test run, it often tears down parts of the fixture
> that are needed in order to do useful post_mortem debugging of the
> exception, such as closing the request or db connections. What is the
> best way to do post_mortem debugging with the stack in the state it was
> at the time of the exception?
What I always do is find the line of code that raises the exception and
wrap it with
try:
...
except:
import pdb; pdb.set_trace()
which is more or less exactly what you do:
> For a while now, I've been repeatedly modifying eggs in my development
> environment at the relevant try/finally clauses to invoke post_mortem
> before the tear down is done, sub-optimal to say the least. :) I find
> myself doing it often its time to invest in a better way.
Worst part is when you use a shared buildout egg cache and forget to
undo your experimental changes.
Marius Gedminas
--
http://pov.lt/ -- Zope 3 consulting and development
_______________________________________________
Zope-Dev maillist - [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope )
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQFLFrM1kVdEXeem148RApXWAJ9fchdLWxE0RGGgiUAbhfuVLiiLjwCeKe/w W0VHv+8DdtAgjnwSJPYydds= =4Tu6 -----END PGP SIGNATURE-----