-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ross Patterson wrote: > Tres Seaver <tsea...@palladion.com> writes: > >> Are you using try:...finally:... inside your testcase methods? If so, >> why not just move the cleanup invocation into your 'tearDown' for the >> testcase class: at that point, the '-D' option to the testrunner will >> stop you at the error, with the tearDown not yet called. > > 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.
OK. In such cases, I usually add a 'pdb.set_trace' to the testcase just before calling into the application-under-test, and step in from there. >> Or are you doing this in doctests? If so, move the code you are testing >> into a real testing framework. ;) > > Oh, goody. Derogatory evangelism. :) Doctests have tearDown just like > other tests. The teardown for doctests runs at the end of the entire text file, which is far too late for the kind of granular teardown needed to maintain proper test isolation. Because of this granularity, people sometimes inline 'try:...finally:...' into the body of the tests, trying to achieve some isolation / cleanliness. Doctests don't work for thorough unit testing: trying to make them substitue for unit tests just ruins any value they have as documentation. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAksWu+0ACgkQ+gerLs4ltQ5VZgCg0PljroCmLWSO/jjx7dUTu4sj Af8AoID1nhnnzzqtvqNZUwo5FO4YmPtU =4Zx2 -----END PGP 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 )