Skip to content

Commit

Permalink
appease flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
zackgalbreath committed Jun 26, 2024
1 parent 0690104 commit 17ee275
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions images/gh-gl-sync/SpackCIBridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

sentry_sdk.init(traces_sample_rate=0.1)


def _durable_subprocess_run(*args, **kwargs):
"""
Calls subprocess.run with retries/exponential backoff on failure.
Expand All @@ -39,6 +40,7 @@ def _durable_subprocess_run(*args, **kwargs):
)
time.sleep(2 ** (1 + attempt_num))


class SpackCIBridge(object):

def __init__(self, gitlab_repo="", gitlab_host="", gitlab_project="", github_project="",
Expand Down Expand Up @@ -205,7 +207,7 @@ def list_github_prs(self):
# of the main branch.
tmp_pr_branch = f"temporary_{pr_string}"
_durable_subprocess_run(["git", "fetch", "--unshallow", "github",
f"refs/pull/{pull.number}/head:{tmp_pr_branch}"])
f"refs/pull/{pull.number}/head:{tmp_pr_branch}"])
# Get the merge base between this PR and the main branch.
try:
merge_base_sha = _durable_subprocess_run(
Expand Down Expand Up @@ -262,7 +264,7 @@ def list_github_prs(self):
# where it will kick off a CI pipeline.
try:
_durable_subprocess_run(["git", "fetch", "--unshallow", "github",
f"{pull.merge_commit_sha}:{pr_string}"])
f"{pull.merge_commit_sha}:{pr_string}"])
except subprocess.CalledProcessError:
print("Failed to locally checkout PR {0} ({1}). Skipping"
.format(pull.number, pull.merge_commit_sha))
Expand Down
1 change: 1 addition & 0 deletions images/gh-gl-sync/test_SpackCIBridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def side_effect(*args, **kwargs):
# Restore the original subprocess.run method
subprocess.run = actual_run_method


def test_list_github_prs(capfd):
"""Test the list_github_prs method."""
dt = datetime.now()
Expand Down

0 comments on commit 17ee275

Please sign in to comment.