本文整理汇总了Python中app.master.build.Build._slaves_allocated方法的典型用法代码示例。如果您正苦于以下问题:Python Build._slaves_allocated方法的具体用法?Python Build._slaves_allocated怎么用?Python Build._slaves_allocated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.master.build.Build
的用法示例。
在下文中一共展示了Build._slaves_allocated方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cancel_exits_early_if_build_not_running
# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import _slaves_allocated [as 别名]
def test_cancel_exits_early_if_build_not_running(self):
build = Build(BuildRequest({}))
build._unstarted_subjobs = Queue()
slave_mock = Mock()
build._slaves_allocated = [slave_mock]
build._status = Mock(return_value=BuildStatus.FINISHED)
build.cancel()
self.assertFalse(build._is_canceled, "Build should not be canceled")
self.assertEqual(slave_mock.teardown.call_count, 0, "Teardown should not have been called")
示例2: test_cancel_depletes_queue_and_sets_canceled
# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import _slaves_allocated [as 别名]
def test_cancel_depletes_queue_and_sets_canceled(self):
build = Build(BuildRequest({}))
build._unstarted_subjobs = Queue()
build._unstarted_subjobs.put(1)
slave_mock = Mock()
build._slaves_allocated = [slave_mock]
build.cancel()
self.assertTrue(build._is_canceled, "Build should've been canceled")
self.assertTrue(build._unstarted_subjobs.empty(), "Build's unstarted subjobs should've been depleted")
示例3: test_teardown_called_on_slave_when_no_subjobs_remain
# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import _slaves_allocated [as 别名]
def test_teardown_called_on_slave_when_no_subjobs_remain(self):
build = Build(BuildRequest({}))
slave = Slave('', 1)
slave.teardown = MagicMock()
slave.free_executor = MagicMock(return_value=0)
build._unstarted_subjobs = Queue()
build._slaves_allocated = [slave]
build.execute_next_subjob_or_teardown_slave(slave)
slave.teardown.assert_called_with()
示例4: test_teardown_called_on_slave_when_slave_in_shutdown_mode
# 需要导入模块: from app.master.build import Build [as 别名]
# 或者: from app.master.build.Build import _slaves_allocated [as 别名]
def test_teardown_called_on_slave_when_slave_in_shutdown_mode(self):
build = Build(BuildRequest({}))
slave = Slave('', 1)
slave.teardown = MagicMock()
slave._is_in_shutdown_mode = True
slave.free_executor = MagicMock(return_value=0)
build._unstarted_subjobs = Queue()
build._unstarted_subjobs.put(Mock(spec=Subjob))
build._slaves_allocated = [slave]
build.execute_next_subjob_or_teardown_slave(slave)
slave.teardown.assert_called_with()