From 8fd02d927475c4ecf25bdc1826a9d11e685cbdc3 Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Tue, 11 Jun 2024 17:28:53 +0200 Subject: [PATCH] Fixes --- process_pr.py | 2 +- ...estProcessPr.test_code_check_approved.json | 123 +++++++++--------- tests/test_process_pr.py | 17 +-- 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/process_pr.py b/process_pr.py index 4389a5abe6bb..e1a9d6b98e3e 100644 --- a/process_pr.py +++ b/process_pr.py @@ -2352,7 +2352,7 @@ def process_pr(repo_config, gh, repo, issue, dryRun, cmsbuild_user=None, force=F releaseManagersMsg = "" if releaseManagers: releaseManagersMsg = format( - "%(managers)s you are the release manager for this.\n", managers=sorted(managers) + "%(managers)s you are the release manager for this.\n", managers=managers ) # Add a Warning if the pull request was done against a patch branch diff --git a/tests/PRActionData/TestProcessPr.test_code_check_approved.json b/tests/PRActionData/TestProcessPr.test_code_check_approved.json index df407db0822b..8eadf047aec1 100644 --- a/tests/PRActionData/TestProcessPr.test_code_check_approved.json +++ b/tests/PRActionData/TestProcessPr.test_code_check_approved.json @@ -1,61 +1,64 @@ -[ - { - "type": "load-bot-cache", - "data": { - "commits": { - "2a9454e30606b17e52000110972998326ce9e428": { - "files": [ - "Utilities/ReleaseScripts/test/BuildFile.xml" - ], - "squashed": false, - "time": 1711538467 - } - }, - "emoji": {}, - "last_seen_sha": "2a9454e30606b17e52000110972998326ce9e428", - "signatures": {} - } - }, - { - "type": "status", - "data": { - "commit": "2a9454e30606b17e52000110972998326ce9e428", - "state": "pending", - "target_url": null, - "description": "Waiting for authorized user to issue the test command.", - "context": "bot/17/jenkins" - } - }, - { - "type": "add-label", - "data": [ - "code-checks-approved" - ] - }, - { - "type": "remove-label", - "data": [ - "code-checks-pending" - ] - }, - { - "type": "status", - "data": { - "commit": "2a9454e30606b17e52000110972998326ce9e428", - "state": "success", - "target_url": "https://github.com/iarspider-cmssw/cmssw/pull/17#issuecomment-2045177271", - "description": "Check details", - "context": "cms/17/code-checks" - } - }, - { - "type": "status", - "data": { - "commit": "2a9454e30606b17e52000110972998326ce9e428", - "state": "success", - "target_url": "https://github.com/iarspider-cmssw/cmssw/pull/17#issuecomment-2045177271", - "description": "Comment by iarspider at 2024-04-09 13:25:57 UTC processed.", - "context": "bot/17/ack" - } - } +[{ + "type": "load-bot-cache", + "data": { + "commits": { + "2a9454e30606b17e52000110972998326ce9e428": { + "files": [ + "Utilities/ReleaseScripts/test/BuildFile.xml" + ], + "squashed": false, + "time": 1711538467 + } + }, + "emoji": {}, + "last_seen_sha": "2a9454e30606b17e52000110972998326ce9e428", + "signatures": {} + } + }, + { + "type": "status", + "data": { + "commit": "2a9454e30606b17e52000110972998326ce9e428", + "state": "pending", + "target_url": null, + "description": "Waiting for authorized user to issue the test command.", + "context": "bot/17/jenkins" + } + }, + { + "type": "add-label", + "data": [ + "code-checks-approved" + ] + }, + { + "type": "remove-label", + "data": [ + "code-checks-pending" + ] + }, + { + "type": "status", + "data": { + "commit": "2a9454e30606b17e52000110972998326ce9e428", + "state": "success", + "target_url": "https://github.com/iarspider-cmssw/cmssw/pull/17#issuecomment-2045177271", + "description": "Check details", + "context": "cms/17/code-checks" + } + }, + { + "type": "create-comment", + "data": "A new Pull Request was created by @iarspider for master.\n\nIt involves the following packages:\n\n- Utilities/ReleaseScripts (**core**)\n\n\n@Dr15Jones, @iarspider, @makortel, @smuzaffar can you please review it and eventually sign? Thanks.\n@wddgit this is something you requested to watch as well.\n@iarspider you are the release manager for this.\n\ncms-bot commands are listed here\n" + }, + { + "type": "status", + "data": { + "commit": "2a9454e30606b17e52000110972998326ce9e428", + "state": "success", + "target_url": "https://github.com/iarspider-cmssw/cmssw/pull/17#issuecomment-2045177271", + "description": "Comment by iarspider at 2024-04-09 13:25:57 UTC processed.", + "context": "bot/17/ack" + } + } ] \ No newline at end of file diff --git a/tests/test_process_pr.py b/tests/test_process_pr.py index ec3f92a12860..14ab753b8da1 100644 --- a/tests/test_process_pr.py +++ b/tests/test_process_pr.py @@ -68,7 +68,10 @@ def issue__edit( if milestone != github.GithubObject.NotSet: actions.append( - {"type": "update-milestone", "data": {"id": milestone.id, "title": milestone.title}} + { + "type": "update-milestone", + "data": {"id": milestone.number, "title": milestone.title}, + } ) if state == "closed": @@ -97,14 +100,6 @@ def commit__create_status(self, state, target_url=None, description=None, contex } ) - if target_url is None: - target_url = github.GithubObject.NotSet - - if description is None: - description = github.GithubObject.NotSet - - if context is None: - context = github.GithubObject.NotSet print( "DRY RUN: set commit status state={0}, target_url={1}, description={2}, context={3}".format( state, target_url, description, context @@ -144,6 +139,7 @@ def get_commit_files_pygithub(repo, commit): def read_bot_cache(data): res = process_pr__read_bot_cache(data) actions.append({"type": "load-bot-cache", "data": res}) + return res ################################################################################ @@ -263,6 +259,7 @@ def setUp(self): sys.path.insert(0, repo_config_dir) if "repo_config" in sys.modules: + print("Reloading repo_config...") importlib.reload(sys.modules["repo_config"]) importlib.reload(sys.modules["milestones"]) importlib.reload(sys.modules["releases"]) @@ -287,7 +284,7 @@ def setUp(self): self.process_pr_module.set_comment_emoji_cache = set_comment_emoji_cache process_pr__create_property_file = self.process_pr_module.create_property_file - self.process_pr.create_property_file = create_property_file + self.process_pr_module.create_property_file = create_property_file process_pr__on_labels_changed = self.process_pr_module.on_labels_changed self.process_pr_module.on_labels_changed = on_labels_changed