[Twisted-Python] Re: [Twisted-commits] r15100 - So I really do want this stuff

Jonathan Lange jml at mumak.net
Mon Nov 14 15:31:17 MST 2005


On 15/11/05, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Mon, 14 Nov 2005 08:10:08 +1100, Jonathan Lange <jml at mumak.net> wrote:
> >On 13/11/05, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> >> On Sun, 13 Nov 2005 12:33:41 +1100, Jonathan Lange <jml at mumak.net> wrote:
> >> >This is a bug, not a feature.
> >>
> >> Why is it a bug?
> >>
> >
> >If your test case (i.e. test method) uses attributes on self, the only
> >way to guarantee they'll be there is to define them in setUp --
> >whether in Trial or pyunit. If they aren't defined in setUp, then they
> >won't be there in pyunit, and they *might* be there in Trial -- it
> >will depend on the command line options. [Proofs attached].
>
> This does not surprise me.  I guess it surprised Brian, but presumably he's learned his lesson now ;)  It seems to me the way it *should* work.  At the very least, it's the way it has always worked, to the best of my understanding.  Perhaps documentation on this topic is lacking, but that suggests to me that we should improve the documentation, not that we should change the mechanism to operate in a different, incompatible (probably also undocumented ;) manner.

It surprised Brian because every other unit testing framework built on
xUnit behaves differently.

Also, how would not sharing attributes be incompatible?

> Looking through Twisted's test suite, I don't see a single TestCase subclass which defines __init__.

The relevance escapes me.

> So... I still don't get how it's a bug.
>

It's not a bug per se; it's a bad feature.  Please forgive me for
using inaccurate idioms.

cheers,
jml




More information about the Twisted-Python mailing list