Skip to content

Commit 5e6c561

Browse files
committed
also pick up on --github-org in sync_branch_with_develop + fix patterns in test_sync_branch_with_develop
1 parent a7875cc commit 5e6c561

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

easybuild/tools/github.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,9 +2044,12 @@ def sync_branch_with_develop(branch_name):
20442044
git_working_dir = tempfile.mkdtemp(prefix='git-working-dir')
20452045
git_repo = init_repo(git_working_dir, target_repo)
20462046

2047-
setup_repo(git_repo, github_user, target_repo, branch_name)
2047+
# GitHub organisation or GitHub user where branch is located
2048+
github_account = build_option('github_org') or github_user
2049+
2050+
setup_repo(git_repo, github_account, target_repo, branch_name)
20482051

20492052
sync_with_develop(git_repo, branch_name, target_account, target_repo)
20502053

20512054
# push updated branch back to GitHub (unless we're doing a dry run)
2052-
return push_branch_to_github(git_repo, github_user, target_repo, branch_name)
2055+
return push_branch_to_github(git_repo, github_account, target_repo, branch_name)

test/framework/options.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,18 +3168,20 @@ def test_sync_branch_with_develop(self):
31683168
'--sync-branch-with-develop=%s' % test_branch,
31693169
'--dry-run',
31703170
]
3171-
txt, _ = self._run_mock_eb(args, do_build=True, raise_error=True, testing=False)
3171+
stdout, stderr = self._run_mock_eb(args, do_build=True, raise_error=True, testing=False)
3172+
3173+
self.assertFalse(stderr)
31723174

31733175
github_path = r"boegel/easybuild-easyconfigs\.git"
31743176
pattern = '\n'.join([
31753177
r"== temporary log file in case of crash .*",
31763178
r"== fetching branch '%s' from https://github\.com/%s\.\.\." % (test_branch, github_path),
31773179
r"== pulling latest version of 'develop' branch from easybuilders/easybuild-easyconfigs\.\.\.",
3178-
r"== merging 'develop' branch into PR branch 'develop'\.\.\.",
3179-
r"== pushing branch 'develop' to remote '.*' \(git@github\.com:%s\) \[DRY RUN\]" % github_path,
3180+
r"== merging 'develop' branch into PR branch '%s'\.\.\." % test_branch,
3181+
r"== pushing branch '%s' to remote '.*' \(git@github\.com:%s\) \[DRY RUN\]" % (test_branch, github_path),
31803182
])
31813183
regex = re.compile(pattern)
3182-
self.assertTrue(regex.match(txt), "Pattern '%s' doesn't match: %s" % (regex.pattern, txt))
3184+
self.assertTrue(regex.match(stdout), "Pattern '%s' doesn't match: %s" % (regex.pattern, stdout))
31833185

31843186
def test_new_pr_python(self):
31853187
"""Check generated PR title for --new-pr on easyconfig that includes Python dependency."""

0 commit comments

Comments
 (0)