def startService(self): upgradeConfig = {'basedir': self.basedir, 'quiet': True} masterConfig = loadConfig(upgradeConfig, self.configFile) d = upgradeDatabase(upgradeConfig, masterConfig) d.addCallback(lambda _: self.afterService.setServiceParent(self.parent)) d.addErrback(log.err) d.addErrback(lambda _: reactor.stop())
def test_loadConfig_exception(self): @classmethod def loadConfig(cls, basedir, filename): raise RuntimeError() self.patch(config_module.MasterConfig, 'loadConfig', loadConfig) cfg = upgrade_master.loadConfig(mkconfig()) self.assertIdentical(cfg, None) self.assertInStdout('RuntimeError')
def test_loadConfig_ConfigErrors(self): @classmethod def loadConfig(cls, basedir, filename): raise config_module.ConfigErrors(['oh noes']) self.patch(config_module.MasterConfig, 'loadConfig', loadConfig) cfg = upgrade_master.loadConfig(mkconfig()) self.assertIdentical(cfg, None) self.assertInStdout('oh noes')
def test_loadConfig(self): @classmethod def loadConfig(cls, basedir, filename): return config_module.MasterConfig() self.patch(config_module.MasterConfig, 'loadConfig', loadConfig) cfg = upgrade_master.loadConfig(mkconfig()) self.assertIsInstance(cfg, config_module.MasterConfig) self.assertInStdout('checking')
def startService(self): upgradeConfig = {'basedir': self.basedir, 'quiet': True} masterConfig = loadConfig(upgradeConfig, self.configFile) d = upgradeDatabase(upgradeConfig, masterConfig) d.addCallback( lambda _: self.afterService.setServiceParent(self.parent)) d.addErrback(log.err) d.addErrback(lambda _: reactor.stop())