[Twisted-Python] Re: [Twisted-commits] r15100 - So I really do want this stuff
jml at mumak.net
Mon Nov 14 17:27:28 EST 2005
On 15/11/05, Itamar Shtull-Trauring <itamar at itamarst.org> wrote:
> On Mon, 2005-11-14 at 08:10 +1100, Jonathan Lange wrote:
> > 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].
> pyunit compatability should not be a goal for trial unless, as I've said
> before, you can get pyunit to support the reactor-running policy trial
> ought to have, i.e. more or less reactor.run() only once and
> reactor.stop() when all tests are done.
Sorry, it seems I gave the wrong emphasis. The thrust of my post was
intended to be this:
There is *only one* way to guarantee attributes of self for your test
case: Define them in setUp.
pyunit makes this explicit. Trial makes it a matter of chance. This
is a contrast, not a compatibility point.
Unit tests should be self-contained *units*. They should be isolated
from one another, and they should be reproducable. The order in which
tests are run should have no bearing on their success or failure.
More information about the Twisted-Python