def tearDown(self): TestCase.tearDown(self) wx.GetApp().testing = False def testHandlers(self): # event system requires App mixin; we need to make it more testable return app = wx.GetApp() for action in dir(actionIDs): app.event_fired = None if action.startswith("__"): continue id = getattr(actionIDs, action, -1) self.assert_(action != -1) if isinstance( id, int) and not id == wx.ID_EXIT and not id in popupActions: print "Firing handler for id=%r" % id fire_action_event(id) app.Yield() self.assert_(app.event_fired, "No event fired for action %s" % action) if __name__ == "__main__": test_main()
def setUp(self): try: Driver.stop() except Exception: pass def tearDown(self): try: Driver.stop() except Exception: pass def testStart(self): self.failUnlessEqual(Driver.start(self.profile), STARTED, "driver failed to start") self.failUnless(Driver.running(), "driver failed to start") def testAlreadyStarted(self): self.failUnlessEqual(Driver.start(self.profile), STARTED, "driver failed to start") self.failUnless(Driver.running(), "driver failed to start") self.failUnlessEqual(Driver.start(self.profile), ALREADY_RUNNING, "driver did not recognize it was already started") self.failUnless(Driver.running(), "driver failed to start") def testStop(self): self.failUnlessEqual(Driver.start(self.profile), STARTED, "driver failed to start") self.failUnless(Driver.running(), "driver failed to start") Driver.stop() self.failIf(Driver.running()) if __name__ == '__main__': test_main()