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

Jonathan Lange jml at mumak.net
Sat Nov 12 20:33:41 EST 2005


On 13/11/05, James Y Knight <foom at fuhm.net> wrote:
> On Nov 12, 2005, at 4:34 PM, Jonathan Lange wrote:
> > On 13/11/05, James Y Knight <foom at fuhm.net> wrote:
> >>
> >> Maybe this is a stupid question, but I'm confused as to why the
> >> implementation isn't straightforward, something along the lines of
> >> the following:
> >>
> >> for each module to test:
> >>    for each class that is a subclass of TestCase in module:
> >>      testCase = class()
> >>      testCase.setUpClass()
> >>      for each method in testCase:
> >>        testCase.setUp()
> >>        testCase.method()
> >>        testCase.tearDown()
> >>      testCase.tearDownClass()
> >>
> >> Now I now it has to be somewhat more complicated, due to error
> >> handling, deferred handling, suppress, etc, but it does seem like
> >> that would be the outline...can it not be?
> >>
> >
> > The short answer: An instance of a TestCase subclass represents a
> > single test.
>
> But not to the user...if I set attributes on the instance, they stay
> set across all test methods.

This is a bug, not a feature.

> So what is this multiple-instance thing
> really for? Is this just an annoyance forced by unittest
> compatibility, or is there actually a reason for that complication?

It's an annoyance forced by wanting to remove aforementioned bug and
by wanting to have clean code within trial.




More information about the Twisted-Python mailing list