Michael Foord <mich...@voidspace.org.uk> added the comment: A use case for running clean ups before tearDown (in which case addCleanUp would need to raise an exception if called during tearDown).
You have existing code which (for example) creates an SSH connection in setUp and removes it in tearDown. If clean ups are run after tearDown then you can't use addCleanup inside tests to deallocate resources that rely on the SSH connection being there (i.e. issue a remote command). Switching to use clean ups would require rewriting the existing code. Running clean ups before tearDown is more likely to fit in with existing test code. The downsides are that it makes adding clean ups in tearDown impossible (but why would you want to do that?) and you can't use clean ups for any resource accessed in tearDown (which you may want to do but won't be the case for any code that currently exists...). We probably need a third party arbiter to pick which is the most sane. :-) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5679> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com