Re: zope.testing.testrunner.debug.post_mortem and try/finally
Ross Patterson <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Message-ID | <[email protected]> |
Benji York <[email protected]> writes: > On Wed, Dec 2, 2009 at 1:22 PM, Ross Patterson <[email protected]> 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 _______________________________________________ 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 )