本文整理汇总了Python中bitten.model.BuildStep.fetch方法的典型用法代码示例。如果您正苦于以下问题:Python BuildStep.fetch方法的具体用法?Python BuildStep.fetch怎么用?Python BuildStep.fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bitten.model.BuildStep
的用法示例。
在下文中一共展示了BuildStep.fetch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fetch
# 需要导入模块: from bitten.model import BuildStep [as 别名]
# 或者: from bitten.model.BuildStep import fetch [as 别名]
def test_fetch(self):
db = self.env.get_db_cnx()
cursor = db.cursor()
cursor.execute("INSERT INTO bitten_step VALUES (%s,%s,%s,%s,%s,%s)",
(1, 'test', 'Foo bar', BuildStep.SUCCESS, 0, 0))
step = BuildStep.fetch(self.env, build=1, name='test')
self.assertEqual(1, step.build)
self.assertEqual('test', step.name)
self.assertEqual('Foo bar', step.description)
self.assertEqual(BuildStep.SUCCESS, step.status)
示例2: _process_build_step
# 需要导入模块: from bitten.model import BuildStep [as 别名]
# 或者: from bitten.model.BuildStep import fetch [as 别名]
'Content-Disposition':
'attachment; filename=recipe_%s_r%s.xml' %
(config.name, build.rev)})
def _process_build_step(self, req, config, build):
try:
elem = xmlio.parse(req.read())
except xmlio.ParseError, e:
self.log.error('Error parsing build step result: %s', e,
exc_info=True)
self._send_error(req, HTTP_BAD_REQUEST, 'XML parser error')
stepname = elem.attr['step']
# we should have created this step previously; if it hasn't,
# the master and slave are processing steps out of order.
step = BuildStep.fetch(self.env, build=build.id, name=stepname)
if not step:
self._send_error(req, HTTP_CONFLICT, 'Build step has not been created.')
recipe = Recipe(xmlio.parse(config.recipe))
index = None
current_step = None
for num, recipe_step in enumerate(recipe):
if recipe_step.id == stepname:
index = num
current_step = recipe_step
if index is None:
self._send_error(req, HTTP_FORBIDDEN,
'No such build step' % stepname)
last_step = index == num