当前位置: 首页>>代码示例>>Python>>正文


Python Review.publish_problems方法代码示例

本文整理汇总了Python中lintreview.review.Review.publish_problems方法的典型用法代码示例。如果您正苦于以下问题:Python Review.publish_problems方法的具体用法?Python Review.publish_problems怎么用?Python Review.publish_problems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lintreview.review.Review的用法示例。


在下文中一共展示了Review.publish_problems方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_publish_problems_remove_ok_label

# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_problems [as 别名]
    def test_publish_problems_remove_ok_label(self):
        problems = Problems()

        filename_1 = 'Console/Command/Task/AssetBuildTask.php'
        errors = (
            (filename_1, 117, 'Something bad'),
            (filename_1, 119, 'Something bad'),
        )
        problems.add_many(errors)
        sha = 'abc123'

        review = Review(self.gh, 3)
        label = 'No lint errors'

        with add_ok_label(self.gh, 3, review, label):
            sha = 'abc123'
            review.publish_problems(problems, sha)

        assert self.issue.remove_label.called, 'Label should be removed'
        assert self.pr.create_review_comment.called, 'Comments should be added'
        eq_(2, self.pr.create_review_comment.call_count)

        self.issue.remove_label.assert_called_with(label)
        assert_review_comments_created(
            self.pr.create_review_comment.call_args_list,
            errors,
            sha)
开发者ID:pSub,项目名称:lint-review,代码行数:29,代码来源:test_review.py

示例2: test_publish_problems

# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_problems [as 别名]
    def test_publish_problems(self):
        gh = Mock()
        problems = Problems()

        filename_1 = 'Console/Command/Task/AssetBuildTask.php'
        errors = (
            (filename_1, 117, 'Something bad'),
            (filename_1, 119, 'Something bad'),
        )
        problems.add_many(errors)
        sha = 'abc123'

        review = Review(gh, 3)
        review.publish_problems(problems, sha)

        assert gh.pull_requests.comments.create.called
        eq_(2, gh.pull_requests.comments.create.call_count)
        calls = gh.pull_requests.comments.create.call_args_list

        expected = call(3, {
            'commit_id': sha,
            'path': errors[0][0],
            'position': errors[0][1],
            'body': errors[0][2]
        })
        eq_(calls[0], expected)

        expected = call(3, {
            'commit_id': sha,
            'path': errors[1][0],
            'position': errors[1][1],
            'body': errors[1][2]
        })
        eq_(calls[1], expected)
开发者ID:hutchic,项目名称:lint-review,代码行数:36,代码来源:test_review.py

示例3: test_publish_problems_remove_ok_label

# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_problems [as 别名]
    def test_publish_problems_remove_ok_label(self):
        problems = Problems()

        filename_1 = 'Console/Command/Task/AssetBuildTask.php'
        errors = (
            (filename_1, 117, 'Something bad'),
            (filename_1, 119, 'Something bad'),
        )
        problems.add_many(errors)
        sha = 'abc123'
        config = {'OK_LABEL': 'No lint'}

        review = Review(self.repo, self.pr, config)
        sha = 'abc123'
        review.publish_problems(problems, sha)

        assert self.pr.remove_label.called, 'Label should be removed'
        assert self.pr.create_review_comment.called, 'Comments should be added'
        eq_(2, self.pr.create_review_comment.call_count)

        self.pr.remove_label.assert_called_with(config['OK_LABEL'])
        assert_review_comments_created(
            self.pr.create_review_comment.call_args_list,
            errors,
            sha)
开发者ID:Ronan-,项目名称:lint-review,代码行数:27,代码来源:test_review.py

示例4: test_publish_problems_add_ok_label

# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_problems [as 别名]
    def test_publish_problems_add_ok_label(self):
        gh = Mock()
        problems = Problems()

        filename_1 = 'Console/Command/Task/AssetBuildTask.php'
        errors = (
            (filename_1, 117, 'Something bad'),
            (filename_1, 119, 'Something bad'),
        )
        problems.add_many(errors)
        sha = 'abc123'

        review = Review(gh, 3)
        label = config.get('OK_LABEL', 'No lint errors')

        with add_ok_label(gh, 3, label):
            sha = 'abc123'
            review.publish_problems(problems, sha)

        assert gh.issues.labels.remove_from_issue.called
        assert gh.pull_requests.comments.create.called
        eq_(2, gh.pull_requests.comments.create.call_count)
        assert_add_to_issue(gh)

        calls = gh.issues.labels.remove_from_issue.call_args_list

        expected = call(3, label)
        eq_(calls, [expected])

        calls = gh.pull_requests.comments.create.call_args_list

        expected = call(3, {
            'commit_id': sha,
            'path': errors[0][0],
            'position': errors[0][1],
            'body': errors[0][2]
        })
        eq_(calls[0], expected)

        expected = call(3, {
            'commit_id': sha,
            'path': errors[1][0],
            'position': errors[1][1],
            'body': errors[1][2]
        })
        eq_(calls[1], expected)
开发者ID:hutchic,项目名称:lint-review,代码行数:48,代码来源:test_review.py

示例5: test_publish_problems

# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_problems [as 别名]
    def test_publish_problems(self):
        problems = Problems()

        filename_1 = 'Console/Command/Task/AssetBuildTask.php'
        errors = (
            (filename_1, 117, 'Something bad'),
            (filename_1, 119, 'Something bad'),
        )
        problems.add_many(errors)
        sha = 'abc123'

        review = Review(self.gh, 3)
        review.publish_problems(problems, sha)

        assert self.pr.create_review_comment.called
        eq_(2, self.pr.create_review_comment.call_count)

        assert_review_comments_created(
            self.pr.create_review_comment.call_args_list,
            errors,
            sha)
开发者ID:pSub,项目名称:lint-review,代码行数:23,代码来源:test_review.py

示例6: test_publish_with__wait_time

# 需要导入模块: from lintreview.review import Review [as 别名]
# 或者: from lintreview.review.Review import publish_problems [as 别名]
    def test_publish_with__wait_time(self, time):
        gh = Mock()
        problems = Problems()
        review = Review(gh, 3)

        filename_1 = 'Console/Command/Task/AssetBuildTask.php'
        errors = (
            (filename_1, 117, 'Something bad'),
            (filename_1, 119, 'Something bad'),
        )
        problems.add_many(errors)
        sha = 'abc123'

        review.publish_problems(problems, sha, 1)
        assert time.sleep.called
        eq_(2, time.sleep.call_count)
        calls = time.sleep.call_args_list

        expected = call(1)
        eq_(calls[0], expected)
        eq_(calls[1], expected)
开发者ID:colindecarlo,项目名称:lint-review,代码行数:23,代码来源:test_review.py


注:本文中的lintreview.review.Review.publish_problems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。