本文整理匯總了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)