Benji York <benji@zope.com> writes:
On Wed, Dec 2, 2009 at 1:22 PM, Ross Patterson <me@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.
Or maybe a combination of the two where a configuration file is read for file and line numbers at which to do a post_mortem using a settrace hook where if the first one of those is hit no further post_mortem's are executed? Ross