本文整理汇总了Python中buildbot.test.fake.latent.LatentController.patchBot方法的典型用法代码示例。如果您正苦于以下问题:Python LatentController.patchBot方法的具体用法?Python LatentController.patchBot怎么用?Python LatentController.patchBot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.test.fake.latent.LatentController
的用法示例。
在下文中一共展示了LatentController.patchBot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_failed_ping_get_requeued
# 需要导入模块: from buildbot.test.fake.latent import LatentController [as 别名]
# 或者: from buildbot.test.fake.latent.LatentController import patchBot [as 别名]
def test_failed_ping_get_requeued(self):
"""
sendBuilderList can fail due to missing permissions on the workdir,
the build request becomes unclaimed
"""
controller = LatentController('local')
config_dict = {
'builders': [
BuilderConfig(name="testy",
workernames=["local"],
factory=BuildFactory(),
),
],
'workers': [controller.worker],
'protocols': {'null': {}},
# Disable checks about missing scheduler.
'multiMaster': True,
}
master = self.getMaster(config_dict)
builder_id = self.successResultOf(
master.data.updates.findBuilderId('testy'))
# Trigger a buildrequest
bsid, brids = self.createBuildrequest(master, [builder_id])
unclaimed_build_requests = []
self.successResultOf(master.mq.startConsuming(
lambda key, request: unclaimed_build_requests.append(request),
('buildrequests', None, 'unclaimed')))
logs = []
self.successResultOf(master.mq.startConsuming(
lambda key, log: logs.append(log),
('logs', None, 'new')))
# The worker succeed to substantiate
def remote_print(self, msg):
if msg == "ping":
raise TestException("can't ping")
controller.patchBot(self, 'remote_print', remote_print)
controller.start_instance(True)
controller.connect_worker(self)
# Flush the errors logged by the failure.
self.flushLoggedErrors(TestException)
# When the substantiation fails, the buildrequest becomes unclaimed.
self.assertEqual(
set(brids),
set([req['buildrequestid'] for req in unclaimed_build_requests]),
)
# should get 2 logs (html and txt) with proper information in there
self.assertEqual(len(logs), 2)
logs_by_name = {}
for _log in logs:
fulllog = self.successResultOf(
master.data.get(("logs", str(_log['logid']), "raw")))
logs_by_name[fulllog['filename']] = fulllog['raw']
for i in ["err_text", "err_html"]:
self.assertIn("can't ping", logs_by_name[i])
# make sure stacktrace is present in html
self.assertIn(os.path.join(
"integration", "test_latent.py"), logs_by_name[i])
controller.auto_stop(True)