This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rbcollins
Recipients gregory.p.smith, michael.foord, ngie, pitrou, rbcollins
Date 2009-04-05.08:03:47
SpamBayes Score 6.0451644e-14
Marked as misclassified No
Message-id <1238918616.2700.387.camel@lifeless-64>
In-reply-to <1238916354.62.0.874223291437.issue5679@psf.upfronthosting.co.za>
Content
On Sun, 2009-04-05 at 07:25 +0000, Garrett Cooper wrote:
> Garrett Cooper <yanegomi@gmail.com> added the comment:
> 
> I think some perspective is required on this enhancement request. I
> originally filed this issue -- http://bugs.python.org/issue5538 --
> because of the unneeded complexity involved with duplicating
> teardown-related code in setUp because of a step in setUp failing.

Indeed, and in bzr and other unittest extension libraries one of the
first things done is to make tearDown be called always.

> >From my perspective, there are two issues:
> 
> - setUp failing doesn't cleanup on failure unless the test writer
> explicitly adds cleanup logic.

the proposed patch in 5679 runs cleanups always, so this shouldn't be an
issue with the addCleanup functionality.

> - cleanup shouldn't partially replace tearDown -- either supplement it
> or completely replace it longterm. Otherwise the unittest code and
> expectations associated with it will potentially confuse end users.

I'm conceptually fine with this, certainly I've not written a tearDown
for tests in bzr in a very long time.

> Another thought: Why not have an option for defining a method called
> `incrementalTearDown', which replaces `tearDown' from a functional
> standpoint? A method like that would clearly convey that this is
> designed to replace tearDown, it's not the same functionally, and would
> ease migration over the long-term if people chose to use this design
> when writing testcases.

Its much more complex than addCleanup [it will be tied to the MRO], not
as flexible (and in big suites that starts to matter a lot), and unable
to trivially hook into actually used resources [which addCleanup does].

-Rob
History
Date User Action Args
2009-04-05 08:03:51rbcollinssetrecipients: + rbcollins, gregory.p.smith, pitrou, ngie, michael.foord
2009-04-05 08:03:49rbcollinslinkissue5679 messages
2009-04-05 08:03:47rbcollinscreate