本文整理匯總了Python中travispy.TravisPy.job方法的典型用法代碼示例。如果您正苦於以下問題:Python TravisPy.job方法的具體用法?Python TravisPy.job怎麽用?Python TravisPy.job使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類travispy.TravisPy
的用法示例。
在下文中一共展示了TravisPy.job方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setup_method
# 需要導入模塊: from travispy import TravisPy [as 別名]
# 或者: from travispy.TravisPy import job [as 別名]
class Test:
def setup_method(self, method):
if GITHUB_ACCESS_TOKEN:
self._travis = TravisPy.github_auth(GITHUB_ACCESS_TOKEN)
else:
self._travis = TravisPy()
def _get_job_log(self, extended_slug=None, job_id=None):
"""Get a job log."""
filename = get_filename(extended_slug)
if filename:
print('using {0}'.format(filename))
file = codecs.open(filename, 'r', 'utf-8')
log = Log.from_file(file)
if not job_id:
job = get_job(self._travis, extended_slug)
print('set job_id={0}'.format(job.id))
else:
job = self._travis.job(job_id)
assert job.log != ''
save_job_log(job)
log = job.log
return log
def _parse(self, log):
parser = BlockParser()
tree = parser._parse(log.body)
for item in tree:
if isinstance(item, Fold) and not isinstance(item, EmptyFold) and len(item._content) > 1:
print('Fold({0})..'.format(item.name))
for part in item._content:
print(' {0}'.format(part))
else:
print(item)
raise RuntimeError
def _split(self, log):
parser = BlockParser()
blocks = parser.split(log.body)
return blocks
def test_small(self):
class Foo:
body = small
self._split(Foo)
def test_empty_archived_log(self):
log = self._get_job_log('jayvdb/pywikibot-core/1240.15', job_id=81891594)
assert log.body == ''
self._parse(log)
def test_cancelled_1_log(self):
log = self._get_job_log('jayvdb/pywikibot-core/1229.7', job_id=81233866)
assert log.body != ''
self._parse(log)
def test_cancelled_2_log(self):
log = self._get_job_log('jayvdb/pywikibot-core/1210.9', job_id=81215691)
assert log.body != ''
self._parse(log)
def test_corrupt_log(self):
log = self._get_job_log('jayvdb/pywikibot-core/1242.10', job_id=81896198)
assert log.body != ''
with pytest.raises(ParseError) as exception_info:
log._parse()
def test_old_log_structure(self):
log = self._get_job_log('legoktm/pywikibot-core/3.1', job_id=32052931)
assert log.body != ''
blocks = self._split(log)
block_names = list(name for name in blocks.keys() if not name.startswith('_unexpected_blank_lines'))
assert block_names[0] == '_worker'
assert '_worker' in blocks
block = blocks['_worker']
assert block.worker == 'worker-linux-7-2.bb.travis-ci.org:travis-linux-13'
#assert len(block.elements) == 2
#assert isinstance(block.elements[0], Note)
#assert len(block.elements[0].lines) == 1
#assert block.elements[0].lines[0] == 'Using worker: worker-linux-7-2.bb.travis-ci.org:travis-linux-13'
#assert isinstance(block.elements[1], BlankLine)
print('block_names', block_names)
assert 'before_install' in block_names
assert 'install' in block_names
assert 'script' in block_names
#.........這裏部分代碼省略.........