[Twisted-Python] Remove setupClass branch of trial - what is the motivation?

Ed Suominen general at eepatents.com
Tue Nov 1 15:43:04 EST 2005

Same here, since I actually use setupClass and teardownClass quite a bit
in my own unit tests. To me, there doesn't seem to be to be a valid
reason for any plans to take away the flexibility of performing setup
for an entire TestCase, in addition to or instead of setup for each
individual test. (I use both.)

Below is a use case for setupClass and teardownClass that is about more
than just convenience, especially when more tests are added to the

- Ed Suominen

class TestViews(TestCase):
    Does the View widget permit display of multiple views with tabs as

    def setUpClass(self):
        # Switch in our Mock Overview for testing
        self.oldOverview = view.Overview
        view.Overview = MockOverview
        # Start the clock for window display
        self.t1 = time()
        # Bring up the window
        gui = self.gui = Gui(640, 480)
        self.views = view.Views(gui)

    def tearDownClass(self):
        def wait():
            return time() - self.t1 < SHOW_INTERVAL

        # Let the window stay up for the full interval
        util.spinWhile(wait, 2*SHOW_INTERVAL)
        # Restore the real Overview object
        view.Overview = self.oldOverview

    def testNewTab(self):
        self.views.new(MockSecondView, 'Testing...')

> Date: Tue, 1 Nov 2005 12:38:21 -0500
> From: Jean-Paul Calderone <exarkun at divmod.com>
> Subject: Re: [Twisted-Python] Remove setupClass branch of trial - what
> 	is the	motivation?
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <20051101173821.10365.1778643802.divmod.quotient.2873 at ohm>
> Content-Type: text/plain; format=flowed
> On Tue, 01 Nov 2005 10:47:09 -0500, Itamar Shtull-Trauring <itamar at itamarst.org> wrote:
> >Hi,
> >
> >Still haven't gotten an answer to this; why is the motivation for
> >deprecating a perfectly reasonable feature?
> >
> FWIW, I also would like to know the answer to this question.
> Jp

More information about the Twisted-Python mailing list