本文整理汇总了Python中buildbot.master.BuildMaster.allSchedulers方法的典型用法代码示例。如果您正苦于以下问题:Python BuildMaster.allSchedulers方法的具体用法?Python BuildMaster.allSchedulers怎么用?Python BuildMaster.allSchedulers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.master.BuildMaster
的用法示例。
在下文中一共展示了BuildMaster.allSchedulers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ConfigTest
# 需要导入模块: from buildbot.master import BuildMaster [as 别名]
# 或者: from buildbot.master.BuildMaster import allSchedulers [as 别名]
#.........这里部分代码省略.........
def testSources(self):
# test backwards compatibility. c['sources'] is deprecated.
master = self.buildmaster
master.loadChanges()
master.loadConfig(emptyCfg)
self.failUnlessEqual(list(master.change_svc), [])
sourcesCfg = emptyCfg + \
"""
from buildbot.changes.pb import PBChangeSource
c['sources'] = [PBChangeSource()]
"""
d = master.loadConfig(sourcesCfg)
def _check1(res):
self.failUnlessEqual(len(list(self.buildmaster.change_svc)), 1)
s1 = list(self.buildmaster.change_svc)[0]
self.failUnless(isinstance(s1, PBChangeSource))
self.failUnless(s1.parent)
d.addCallback(_check1)
return d
def shouldBeFailure(self, res, *expected):
self.failUnless(isinstance(res, failure.Failure),
"we expected this to fail, not produce %s" % (res,))
res.trap(*expected)
return None # all is good
def testSchedulerErrors(self):
master = self.buildmaster
master.loadChanges()
master.loadConfig(emptyCfg)
self.failUnlessEqual(master.allSchedulers(), [])
def _shouldBeFailure(res, hint=None):
self.shouldBeFailure(res, AssertionError, ValueError)
if hint:
self.failUnless(str(res).find(hint) != -1)
def _loadConfig(res, newcfg):
return self.buildmaster.loadConfig(newcfg)
d = defer.succeed(None)
# c['schedulers'] must be a list
badcfg = schedulersCfg + \
"""
c['schedulers'] = Scheduler('full', None, 60, ['builder1'])
"""
d.addCallback(_loadConfig, badcfg)
d.addBoth(_shouldBeFailure,
"c['schedulers'] must be a list of Scheduler instances")
# c['schedulers'] must be a list of IScheduler objects
badcfg = schedulersCfg + \
"""
c['schedulers'] = ['oops', 'problem']
"""
d.addCallback(_loadConfig, badcfg)
d.addBoth(_shouldBeFailure,
"c['schedulers'] must be a list of Scheduler instances")
# c['schedulers'] must point at real builders
badcfg = schedulersCfg + \
"""
c['schedulers'] = [Scheduler('full', None, 60, ['builder-bogus'])]