def do_test_master(self): # create the master and set its config m = BuildMaster(self.basedir, self.configfile) # update the DB yield m.db.setup(check_version=False) yield m.db.model.upgrade() # stub out m.db.setup since it was already called above m.db.setup = lambda: None # mock reactor.stop (which trial *really* doesn't # like test code to call!) mock_reactor = mock.Mock(spec=reactor) mock_reactor.callWhenRunning = reactor.callWhenRunning mock_reactor.getThreadPool = reactor.getThreadPool mock_reactor.callFromThread = reactor.callFromThread # start the service yield m.startService(_reactor=mock_reactor) self.failIf(mock_reactor.stop.called, "startService tried to stop the reactor; check logs") # hang out for a fraction of a second, to let startup processes run d = defer.Deferred() reactor.callLater(0.01, d.callback, None) yield d # stop the service yield m.stopService() # and shutdown the db threadpool, as is normally done at reactor stop m.db.pool.shutdown()
def do_test_master(self): # create the master and set its config m = BuildMaster(self.basedir, self.configfile) # update the DB yield m.db.setup(check_version=False) yield m.db.model.upgrade() # stub out m.db.setup since it was already called above m.db.setup = lambda: None # mock reactor.stop (which trial *really* doesn't # like test code to call!) mock_reactor = mock.Mock(spec=reactor) mock_reactor.callWhenRunning = reactor.callWhenRunning # start the service yield m.startService(_reactor=mock_reactor) self.failIf(mock_reactor.stop.called, "startService tried to stop the reactor; check logs") # hang out for a fraction of a second, to let startup processes run d = defer.Deferred() reactor.callLater(0.01, d.callback, None) yield d # stop the service yield m.stopService() # and shutdown the db threadpool, as is normally done at reactor stop m.db.pool.shutdown()
def do_test_master(self): # create the master and set its config m = BuildMaster(self.basedir, self.configfile) m.config = config.MasterConfig.loadConfig( self.basedir, self.configfile) # update the DB yield m.db.setup(check_version=False) yield m.db.model.upgrade() # stub out m.db.setup since it was already called above m.db.setup = lambda : None # mock reactor.stop (which trial *really* doesn't # like test code to call!) mock_reactor = mock.Mock(spec=reactor) mock_reactor.callWhenRunning = reactor.callWhenRunning # start the service yield m.startService(_reactor=mock_reactor) self.failIf(mock_reactor.stop.called, "startService tried to stop the reactor; check logs") # stop the service yield m.stopService() # and shutdown the db threadpool, as is normally done at reactor stop m.db.pool.shutdown()
def do_test_master(self): # create the master and set its config m = BuildMaster(self.basedir, self.configfile) m.config = config.MasterConfig.loadConfig(self.basedir, self.configfile) # update the DB yield m.db.setup(check_version=False) yield m.db.model.upgrade() # stub out m.db.setup since it was already called above m.db.setup = lambda: None # mock reactor.stop (which trial *really* doesn't # like test code to call!) mock_reactor = mock.Mock(spec=reactor) mock_reactor.callWhenRunning = reactor.callWhenRunning # start the service yield m.startService(_reactor=mock_reactor) self.failIf(mock_reactor.stop.called, "startService tried to stop the reactor; check logs") # stop the service yield m.stopService() # and shutdown the db threadpool, as is normally done at reactor stop m.db.pool.shutdown()
def _run_master(self, loaded_config): # create the master m = BuildMaster(self.basedir, self.configfile) # update the DB yield m.db.setup(check_version=False) yield m.db.model.upgrade() # stub out m.db.setup since it was already called above m.db.setup = lambda: None # mock reactor.stop (which trial *really* doesn't # like test code to call!) mock_reactor = mock.Mock(spec=reactor) mock_reactor.callWhenRunning = reactor.callWhenRunning mock_reactor.getThreadPool = reactor.getThreadPool mock_reactor.callFromThread = reactor.callFromThread # mock configuration loading @classmethod def loadConfig(cls, basedir, filename): return loaded_config with mock.patch('buildbot.config.MasterConfig.loadConfig', loadConfig): # start the service yield m.startService(_reactor=mock_reactor) self.failIf(mock_reactor.stop.called, "startService tried to stop the reactor; check logs") # hang out for a fraction of a second, to let startup processes run d = defer.Deferred() reactor.callLater(0.01, d.callback, None) yield d # stop the service yield m.stopService() # and shutdown the db threadpool, as is normally done at reactor stop m.db.pool.shutdown()