From d985b4b181e502183ebe6d12979a6bc191f9cdd3 Mon Sep 17 00:00:00 2001 From: YUNSHEN XIE <1084314248@qq.com> Date: Tue, 2 Aug 2022 14:54:38 +0800 Subject: [PATCH] fix get_pr_ut error (#44787) * fix get_pr_ut error * fix bug --- tools/get_pr_ut.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/get_pr_ut.py b/tools/get_pr_ut.py index d8440ad0489..81d02b99684 100644 --- a/tools/get_pr_ut.py +++ b/tools/get_pr_ut.py @@ -60,12 +60,15 @@ class PRChecker(object): last_commit = None ix = 0 while True: - commits = self.pr.get_commits().get_page(ix) - for c in commits: - last_commit = c.commit - else: + try: + commits = self.pr.get_commits().get_page(ix) + if len(commits) == 0: + raise ValueError("no commit found in {} page".format(ix)) + last_commit = commits[-1].commit + except Exception as e: break - ix = ix + 1 + else: + ix = ix + 1 if last_commit.message.find('test=allcase') != -1: print('PREC test=allcase is set') self.full_case = True -- GitLab