本文整理汇总了Python中lintreview.review.Review.publish_checkrun方法的典型用法代码示例。如果您正苦于以下问题:Python Review.publish_checkrun方法的具体用法?Python Review.publish_checkrun怎么用?Python Review.publish_checkrun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lintreview.review.Review
的用法示例。
在下文中一共展示了Review.publish_checkrun方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_publish_checkrun
# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_checkrun [as 别名]
def test_publish_checkrun(self):
self.repo.create_checkrun = Mock()
tst_config = build_review_config(fixer_ini,
{'PULLREQUEST_STATUS': True})
problems = Problems()
filename_1 = 'Console/Command/Task/AssetBuildTask.php'
errors = (
Comment(filename_1, 117, 8, 'Something bad'),
Comment(filename_1, 119, 9, 'Something worse'),
)
problems.add_many(errors)
run_id = 42
review = Review(self.repo, self.pr, tst_config)
review.publish_checkrun(problems, run_id)
assert self.repo.update_checkrun.called
self.assertEqual(1, self.repo.update_checkrun.call_count)
assert_checkrun(
self,
self.repo.update_checkrun.call_args,
errors,
run_id)
assert self.repo.create_status.called is False, 'no status required'
示例2: test_publish_checkrun__no_problems
# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_checkrun [as 别名]
def test_publish_checkrun__no_problems(self):
self.repo.create_checkrun = Mock()
tst_config = build_review_config(fixer_ini,
{'PULLREQUEST_STATUS': True})
problems = Problems()
run_id = 42
review = Review(self.repo, self.pr, tst_config)
review.publish_checkrun(problems, run_id)
assert self.repo.update_checkrun.called
self.assertEqual(1, self.repo.update_checkrun.call_count)
assert_checkrun(
self,
self.repo.update_checkrun.call_args,
[],
run_id)
assert self.repo.create_status.called is False, 'no status required'
示例3: test_publish_checkrun__has_errors_force_success_status
# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_checkrun [as 别名]
def test_publish_checkrun__has_errors_force_success_status(self):
self.repo.create_checkrun = Mock()
tst_config = build_review_config(fixer_ini,
{'PULLREQUEST_STATUS': False})
self.assertEqual('success', tst_config.failed_review_status(),
'config object changed')
review = Review(self.repo, self.pr, tst_config)
problems = Problems()
filename_1 = 'Console/Command/Task/AssetBuildTask.php'
errors = (
Comment(filename_1, 117, 8, 'Something bad'),
Comment(filename_1, 119, 9, 'Something worse'),
)
problems.add_many(errors)
run_id = 42
review.publish_checkrun(problems, run_id)
assert self.repo.create_status.called is False, 'no status required'
checkrun = self.repo.update_checkrun.call_args[0][1]
self.assertEqual('success', checkrun['conclusion'])
assert len(checkrun['output']['annotations']) > 0
示例4: Processor
# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_checkrun [as 别名]
class Processor(object):
_repository = None
_pull_request = None
_target_path = None
_changes = None
_review = None
_config = None
problems = None
def __init__(self, repository, pull_request, target_path, config):
self._config = config
self._repository = repository
self._pull_request = pull_request
self._target_path = target_path
self.problems = Problems()
self._review = Review(repository, pull_request, config)
def load_changes(self):
log.info('Loading pull request patches from github.')
files = self._pull_request.files()
self._changes = DiffCollection(files)
self.problems.set_changes(self._changes)
def run_tools(self):
if self._changes is None:
raise RuntimeError('No loaded changes, cannot run tools. '
'Try calling load_changes first.')
config = self._config
files_to_check = self._changes.get_files(
ignore_patterns=config.ignore_patterns()
)
commits_to_check = self._pull_request.commits()
tool_list = tools.factory(
config,
self.problems,
self._target_path)
if config.fixers_enabled():
self.apply_fixers(tool_list, files_to_check)
tools.run(tool_list, files_to_check, commits_to_check)
def apply_fixers(self, tool_list, files_to_check):
try:
fixer_context = fixers.create_context(
self._config,
self._target_path,
self._repository,
self._pull_request,
)
fixer_diff = fixers.run_fixers(
tool_list,
self._target_path,
files_to_check)
fixers.apply_fixer_diff(
self._changes,
fixer_diff,
fixer_context)
except (ConfigurationError, WorkflowError) as e:
log.info('Fixer application failed. Got %s', e)
message = u'Unable to apply fixers. {}'.format(e)
self.problems.add(InfoComment(message))
except Exception as e:
log.info('Fixer application failed, '
'rolling back working tree. Got %s', e)
fixers.rollback_changes(self._target_path)
def publish(self, check_run_id=None):
self.problems.limit_to_changes()
if check_run_id:
self._review.publish_checkrun(
self.problems,
check_run_id)
else:
self._review.publish_review(
self.problems,
self._pull_request.head)