zope.testing.testrunner.debug.post_mortem and try/finally

Ross Patterson <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
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?

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.

Is there some Python voodoo I'm unaware of to get a post_mortem to
reflect the stack before try/finally clauses?  If not, is putting
some sort of hook into the relevant try/finally clauses the best way to
address this?  If not, what should I be doing?

If putting hooks into the try/finally clauses is the right way, then it
would be nice to have a somewhat canonical way to do this.  It would
also be nice to have a way to pass something down the line so that
post_mortem() only gets called once per exception.

Thoughts,
Ross

_______________________________________________
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 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.