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

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )

Reply via email to