当前位置: 首页>>代码示例>>Python>>正文


Python Build.setStepFactories方法代码示例

本文整理汇总了Python中buildbot.process.base.Build.setStepFactories方法的典型用法代码示例。如果您正苦于以下问题:Python Build.setStepFactories方法的具体用法?Python Build.setStepFactories怎么用?Python Build.setStepFactories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在buildbot.process.base.Build的用法示例。


在下文中一共展示了Build.setStepFactories方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testBuildLocksAcquired

# 需要导入模块: from buildbot.process.base import Build [as 别名]
# 或者: from buildbot.process.base.Build import setStepFactories [as 别名]
    def testBuildLocksAcquired(self):
        r = FakeRequest()

        b = Build([r])
        b.setBuilder(Mock())
        b.builder.botmaster = FakeMaster()
        slavebuilder = Mock()
        status = Mock()

        l = SlaveLock('lock')
        claimCount = [0]
        lock_access = l.access('counting')
        l.access = lambda mode: lock_access
        real_lock = b.builder.botmaster.getLockByID(l).getLock(slavebuilder)
        def claim(owner, access):
            claimCount[0] += 1
            return real_lock.old_claim(owner, access)
        real_lock.old_claim = real_lock.claim
        real_lock.claim = claim
        b.setLocks([l])

        step = Mock()
        step.return_value = step
        step.startStep.return_value = SUCCESS
        b.setStepFactories([(step, {})])

        b.startBuild(status, None, slavebuilder)

        self.assertEqual(b.result, SUCCESS)
        self.assert_( ('startStep', (b.remote,), {}) in step.method_calls)
        self.assertEquals(claimCount[0], 1)
开发者ID:gvalkov,项目名称:buildbot,代码行数:33,代码来源:test_process_base.py

示例2: testStopBuild

# 需要导入模块: from buildbot.process.base import Build [as 别名]
# 或者: from buildbot.process.base.Build import setStepFactories [as 别名]
    def testStopBuild(self):
        r = FakeRequest()

        b = Build([r])
        b.setBuilder(Mock())

        step = Mock()
        step.return_value = step
        b.setStepFactories([(step, {})])

        slavebuilder = Mock()
        status = Mock()

        def startStep(*args, **kw):
            # Now interrupt the build
            b.stopBuild("stop it")
            return defer.Deferred()
        step.startStep = startStep

        b.startBuild(status, None, slavebuilder)

        self.assert_("Interrupted" in b.text)
        self.assertEqual(b.result, FAILURE)

        self.assert_( ('interrupt', ('stop it',), {}) in step.method_calls)
开发者ID:gvalkov,项目名称:buildbot,代码行数:27,代码来源:test_process_base.py

示例3: testStopBuildWaitingForLocks

# 需要导入模块: from buildbot.process.base import Build [as 别名]
# 或者: from buildbot.process.base.Build import setStepFactories [as 别名]
    def testStopBuildWaitingForLocks(self):
        r = FakeRequest()

        b = Build([r])
        b.setBuilder(Mock())
        b.builder.botmaster = FakeMaster()
        slavebuilder = Mock()
        status = Mock()

        l = SlaveLock('lock')
        lock_access = l.access('counting')
        l.access = lambda mode: lock_access
        real_lock = b.builder.botmaster.getLockByID(l).getLock(slavebuilder)
        b.setLocks([l])

        step = Mock()
        step.return_value = step
        step.startStep.return_value = SUCCESS
        b.setStepFactories([(step, {})])

        real_lock.claim(Mock(), l.access('counting'))

        def acquireLocks(res=None):
            retval = Build.acquireLocks(b, res)
            b.stopBuild('stop it')
            return retval
        b.acquireLocks = acquireLocks

        b.startBuild(status, None, slavebuilder)

        self.assert_( ('startStep', (b.remote,), {}) not in step.method_calls)
        self.assert_(b.currentStep is None)
        self.assertEqual(b.result, EXCEPTION)
        self.assert_( ('interrupt', ('stop it',), {}) not in step.method_calls)
开发者ID:Flumotion,项目名称:buildbot,代码行数:36,代码来源:test_process_base.py

示例4: testRunSuccessfulBuild

# 需要导入模块: from buildbot.process.base import Build [as 别名]
# 或者: from buildbot.process.base.Build import setStepFactories [as 别名]
    def testRunSuccessfulBuild(self):
        r = FakeRequest()

        b = Build([r])
        b.setBuilder(Mock())

        step = Mock()
        step.return_value = step
        step.startStep.return_value = SUCCESS
        b.setStepFactories([(step, {})])

        slavebuilder = Mock()
        status = Mock()

        b.startBuild(status, None, slavebuilder)

        self.assertEqual(b.result, SUCCESS)
        self.assert_( ('startStep', (b.remote,), {}) in step.method_calls)
开发者ID:gvalkov,项目名称:buildbot,代码行数:20,代码来源:test_process_base.py

示例5: testStopBuildWaitingForStepLocks

# 需要导入模块: from buildbot.process.base import Build [as 别名]
# 或者: from buildbot.process.base.Build import setStepFactories [as 别名]
    def testStopBuildWaitingForStepLocks(self):
        r = FakeRequest()

        b = Build([r])
        b.setBuilder(Mock())
        b.builder.botmaster = FakeMaster()
        slavebuilder = Mock()
        status = Mock()

        l = SlaveLock('lock')
        claimCount = [0]
        lock_access = l.access('counting')
        l.access = lambda mode: lock_access
        real_lock = b.builder.botmaster.getLockByID(l).getLock(slavebuilder)

        step = LoggingBuildStep(locks=[lock_access])
        def factory(*args):
            return step
        b.setStepFactories([(factory, {})])

        real_lock.claim(Mock(), l.access('counting'))

        gotLocks = [False]

        def acquireLocks(res=None):
            gotLocks[0] = True
            retval = LoggingBuildStep.acquireLocks(step, res)
            self.assert_(b.currentStep is step)
            b.stopBuild('stop it')
            return retval
        step.acquireLocks = acquireLocks
        step.setStepStatus = Mock()
        step.step_status = Mock()
        step.step_status.addLog().chunkSize = 10
        step.step_status.getLogs.return_value = []

        b.startBuild(status, None, slavebuilder)

        self.assertEqual(gotLocks, [True])
        self.assert_(('stepStarted', (), {}) in step.step_status.method_calls)
        self.assert_("Interrupted" in b.text, b.text)
        self.assertEqual(b.result, FAILURE)
开发者ID:gvalkov,项目名称:buildbot,代码行数:44,代码来源:test_process_base.py


注:本文中的buildbot.process.base.Build.setStepFactories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。