Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iarspider committed Jun 11, 2024
1 parent 217d3c8 commit 8fd02d9
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 71 deletions.
2 changes: 1 addition & 1 deletion process_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
123 changes: 63 additions & 60 deletions tests/PRActionData/TestProcessPr.test_code_check_approved.json
Original file line number Diff line number Diff line change
@@ -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 <a href=\"http://cms-sw.github.io/cms-bot-cmssw-cmds.html\">here</a>\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"
}
}
]
17 changes: 7 additions & 10 deletions tests/test_process_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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


################################################################################
Expand Down Expand Up @@ -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"])
Expand All @@ -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
Expand Down

0 comments on commit 8fd02d9

Please sign in to comment.