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


Python BotMaster._get_processors方法代码示例

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


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

示例1: TestCleanShutdown

# 需要导入模块: from buildbot.process.botmaster import BotMaster [as 别名]
# 或者: from buildbot.process.botmaster.BotMaster import _get_processors [as 别名]

#.........这里部分代码省略.........
        def _check1(ign):
            self.assertEquals(self.master.reactor.stop.called, False)
        d.addCallback(_check1)

        # Now we cause the build to finish, then kick the loop again,
        # empty out the list of running builds, and wait for the shutdown
        # process to finish
        def _finish_build(ign):
            d_finished.callback(None)
            self.master.loop.trigger()
            self.master.builders.values.return_value = []
            return d_shutdown
        d.addCallback(_finish_build)

        # And now we should be done
        def _check2(ign):
            self.assertEquals(self.master.reactor.stop.called, True)
        d.addCallback(_check2)

        return d

    def test_shutdown_cancel(self):
        """Test that we can cancel a shutdown"""
        # Fake some builds
        builder = Mock()
        build = Mock()
        builder.builder_status.getCurrentBuilds.return_value = [build]

        d_finished = defer.Deferred()
        build.waitUntilFinished.return_value = d_finished

        self.master.builders = Mock()
        self.master.builders.values.return_value = [builder]

        d_shutdown = self.master.cleanShutdown()

        # Trigger the loop to get things going
        self.master.loop.trigger()

        # First we wait for it to quiet down again
        d = self.master.loop.when_quiet()

        # Next we check that we haven't stopped yet, since there's a running
        # build.
        # We cancel the shutdown here too
        def _check1(ign):
            self.assertEquals(self.master.reactor.stop.called, False)
            self.master.cancelCleanShutdown()
        d.addCallback(_check1)

        # Now we cause the build to finish, then kick the loop again,
        # empty out the list of running builds, and wait for the shutdown
        # process to finish
        def _finish_build(ign):
            d_finished.callback(None)
            self.master.loop.trigger()
            self.master.builders.values.return_value = []
            return d_shutdown
        d.addCallback(_finish_build)

        # We should still be running!
        def _check2(ign):
            self.assertEquals(self.master.reactor.stop.called, False)
        d.addCallback(_check2)

        return d

    def test_shutdown_no_new_builds(self):
        """Test that no new builds get handed out when we're shutting down"""
        # Fake some builds
        builder = Mock()
        build = Mock()
        builder.builder_status.getCurrentBuilds.return_value = [build]

        d_finished = defer.Deferred()
        build.waitUntilFinished.return_value = d_finished

        self.master.builders = Mock()
        self.master.builders.values.return_value = [builder]

        self.assertEquals(self.master._get_processors(), [builder.run])

        d_shutdown = self.master.cleanShutdown()
        assert d_shutdown

        # Trigger the loop to get things going
        self.master.loop.trigger()

        # First we wait for it to quiet down again
        d = self.master.loop.when_quiet()

        # Next we check that we haven't stopped yet, since there's a running
        # build.
        # Also check that we're not trying to hand out new builds!
        def _check1(ign):
            self.assertEquals(self.master.reactor.stop.called, False)
            self.assertEquals(self.master._get_processors(), [])
        d.addCallback(_check1)

        return d
开发者ID:LittleForker,项目名称:buildbot,代码行数:104,代码来源:test_process_botmaster_BotMaster_cleanshutdown.py


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