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

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 class. - Ed Suominen ---------------------------------------------------------------------------------------------------------------- class TestViews(TestCase): """ Does the View widget permit display of multiple views with tabs as advertised? """ 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) gui.setCentralWidget(self.views) gui.show() 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...')
participants (1)
-
Ed Suominen