[Zope-dev] zope.testing.testrunner.debug.post_mortem and try/finally

Benji York benji at zope.com
Wed Dec 2 13:36:37 EST 2009


On Wed, Dec 2, 2009 at 1:22 PM, Ross Patterson <me at rpatterson.net> wrote:
> I'm sorry, I was unclear, the try/finally clauses are not necessarily in
> *test tearDown* methods (though I used that language), they are often a
> part of the application being tested, such as closing the request,
> closing DB connections, or aborting transactions.

In those situations I just edit the code and put a "import
pdb;pdb.set_trace()" at the top of the finally: block and re-run the
test.

It is an interesting idea to provide some way to make that automatic.
Maybe a settrace hook that will invoke pdb at the top of every finally
clause that is encountered, somewhat similar to the -D option.  You
might end up getting way too many false positives though.

Here's another idea: a testrunner option that takes a file name and line
number and inserts a breakpoint at that position.  That way you can get
the same effect as editing the code without actually having to do so.
-- 
Benji York


More information about the Zope-Dev mailing list