本文整理汇总了Python中bitten.model.BuildStep.insert方法的典型用法代码示例。如果您正苦于以下问题:Python BuildStep.insert方法的具体用法?Python BuildStep.insert怎么用?Python BuildStep.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bitten.model.BuildStep
的用法示例。
在下文中一共展示了BuildStep.insert方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_format_link_in_repos_with_line
# 需要导入模块: from bitten.model import BuildStep [as 别名]
# 或者: from bitten.model.BuildStep import insert [as 别名]
def test_format_link_in_repos_with_line(self):
BuildConfig(self.env, name='test', path='trunk').insert()
build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
status=Build.SUCCESS, slave='hal')
build.insert()
step = BuildStep(self.env, build=build.id, name='foo',
status=BuildStep.SUCCESS)
step.insert()
self.repos.get_node = lambda path, rev: (path, rev)
req = Mock(method='GET', href=Href('/trac'), authname='hal')
comp = SourceFileLinkFormatter(self.env)
formatter = comp.get_formatter(req, build)
# posix
output = formatter(step, None, None, u'error in foo/bar.c:123: bad')
self.assertEqual(Markup, type(output))
self.assertEqual('error in <a href="/trac/browser/trunk/foo/bar.c#L123">'
'foo/bar.c:123</a>: bad', output)
# windows
output = formatter(step, None, None, u'error in foo\\win.c:123: bad')
self.assertEqual(Markup, type(output))
self.assertEqual(r'error in <a href="/trac/browser/trunk/foo/win.c#L123">'
'foo\win.c:123</a>: bad', output)
示例2: test_insert
# 需要导入模块: from bitten.model import BuildStep [as 别名]
# 或者: from bitten.model.BuildStep import insert [as 别名]
def test_insert(self):
step = BuildStep(self.env, build=1, name='test', description='Foo bar',
status=BuildStep.SUCCESS)
step.insert()
self.assertEqual(True, step.exists)
db = self.env.get_db_cnx()
cursor = db.cursor()
cursor.execute("SELECT build,name,description,status,started,stopped "
"FROM bitten_step")
self.assertEqual((1, 'test', 'Foo bar', BuildStep.SUCCESS, 0, 0),
cursor.fetchone())
示例3: test_insert_with_errors
# 需要导入模块: from bitten.model import BuildStep [as 别名]
# 或者: from bitten.model.BuildStep import insert [as 别名]
def test_insert_with_errors(self):
step = BuildStep(self.env, build=1, name='test', description='Foo bar',
status=BuildStep.SUCCESS)
step.errors += ['Foo', 'Bar']
step.insert()
self.assertEqual(True, step.exists)
db = self.env.get_db_cnx()
cursor = db.cursor()
cursor.execute("SELECT build,name,description,status,started,stopped "
"FROM bitten_step")
self.assertEqual((1, 'test', 'Foo bar', BuildStep.SUCCESS, 0, 0),
cursor.fetchone())
cursor.execute("SELECT message FROM bitten_error ORDER BY orderno")
self.assertEqual(('Foo',), cursor.fetchone())
self.assertEqual(('Bar',), cursor.fetchone())
示例4: test_format_bad_links
# 需要导入模块: from bitten.model import BuildStep [as 别名]
# 或者: from bitten.model.BuildStep import insert [as 别名]
def test_format_bad_links(self):
BuildConfig(self.env, name='test', path='trunk').insert()
build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
status=Build.SUCCESS, slave='hal')
build.insert()
step = BuildStep(self.env, build=build.id, name='foo',
status=BuildStep.SUCCESS)
step.insert()
self.repos.get_node = lambda path, rev: (path, rev)
req = Mock(method='GET', href=Href('/trac'), authname='hal')
comp = SourceFileLinkFormatter(self.env)
formatter = comp.get_formatter(req, build)
output = formatter(step, None, None, u'Linking -I../.. with ../libtool')
self.assertEqual(Markup, type(output))
self.assertEqual('Linking -I../.. with ../libtool', output)
示例5: test_format_link_not_in_repos_with_line
# 需要导入模块: from bitten.model import BuildStep [as 别名]
# 或者: from bitten.model.BuildStep import insert [as 别名]
def test_format_link_not_in_repos_with_line(self):
BuildConfig(self.env, name='test', path='trunk').insert()
build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
status=Build.SUCCESS, slave='hal')
build.insert()
step = BuildStep(self.env, build=build.id, name='foo',
status=BuildStep.SUCCESS)
step.insert()
def _raise():
raise TracError('No such node')
self.repos.get_node = lambda path, rev: _raise()
req = Mock(method='GET', href=Href('/trac'), authname='hal')
comp = SourceFileLinkFormatter(self.env)
formatter = comp.get_formatter(req, build)
output = formatter(step, None, None, u'error in foo/bar.c:123: bad')
self.assertEqual(Markup, type(output))
self.assertEqual('error in foo/bar.c:123: bad', output)
示例6: int
# 需要导入模块: from bitten.model import BuildStep [as 别名]
# 或者: from bitten.model.BuildStep import insert [as 别名]
try:
step.started = int(_parse_iso_datetime(elem.attr['time']))
step.stopped = step.started + float(elem.attr['duration'])
except ValueError, e:
self.log.error('Error parsing build step timestamp: %s', e,
exc_info=True)
raise HTTPBadRequest(e.args[0])
if elem.attr['status'] == 'failure':
self.log.warning('Build %s step %s failed', build.id, stepname)
step.status = BuildStep.FAILURE
if current_step.onerror == 'fail':
last_step = True
else:
step.status = BuildStep.SUCCESS
step.errors += [error.gettext() for error in elem.children('error')]
step.insert(db=db)
# Collect log messages from the request body
for idx, log_elem in enumerate(elem.children('log')):
build_log = BuildLog(self.env, build=build.id, step=stepname,
generator=log_elem.attr.get('generator'),
orderno=idx)
for message_elem in log_elem.children('message'):
build_log.messages.append((message_elem.attr['level'],
message_elem.gettext()))
build_log.insert(db=db)
# Collect report data from the request body
for report_elem in elem.children('report'):
report = Report(self.env, build=build.id, step=stepname,
category=report_elem.attr.get('category'),