Questions after testtools merge

Robert Collins robertc at robertcollins.net
Tue Jan 5 19:50:55 GMT 2010


On Fri, 2010-01-01 at 21:37 -0600, John Arbash Meinel wrote:

> >> So *if* an exception is caught during setup, it runs cleanups, but not
> >> teardowns.
> > 
> > Yes, this is a deliberate design decision -- we felt that there should
> > be a way of guaranteeing that a cleanup gets run.
> 
> 
> I would mention that this is a regression for the *bzrlib* test suite.
> Which always ran tearDown even if setUp did not complete. (As evidenced
> by Martin's test suite failures after the merge.)

Actually we should be able to reinstate that behaviour - it was removed
by oversight, not intention.


> >> However, if I read the above correctly, teardown is clearly called
> >> *before* cleanups. Which doesn't quite fit with the fact that setUp is
> >> called before addCleanup, etc.
> >>
> > 
> > The docstring is definitely wrong. Given that you had to delve so
> > deeply into the code, it's also inadequate. I'll fix this now.
> > 
> > jml
> 
> Well, I believe I generally consult the code first anyway. Docstrings
> have a habit of going stale (case in point).
> 
> As for whether tearDown comes before or after cleanups... I favor it
> coming after, but arguably it could go either. Most resources work very
> well in the LIFO that addCleanup provides, and it is unclear how that
> interacts with tearDown. (You can't put the child classes tearDown
> before the parent classes cleanups but after its tearDown, etc.)

Upstream python run cleansups after teardown, and I think we should do
the same, just because that is consistent and its not really an
important conceptual difference.

> I would say a reasonable fix for *bzrlib* is to just deprecate tearDown
> entirely. (put it in our base TestCase), and then fix everything to use
> addCleanup.

That will work too but is effort we don't need to go to.

-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20100106/f042d38c/attachment.pgp 


More information about the bazaar mailing list