Skip to content

Commit

Permalink
Merge branch 'main' into add-py313
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Jun 24, 2024
2 parents 00d52ed + 504dc34 commit 59dd6f8
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 31 deletions.
10 changes: 8 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ updates:
interval: monthly
assignees:
- "ezio-melotti"
open-pull-requests-limit: 10
groups:
pip:
patterns:
- "*"

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
Expand All @@ -16,4 +19,7 @@ updates:
interval: monthly
assignees:
- "ezio-melotti"
open-pull-requests-limit: 10
groups:
actions:
patterns:
- "*"
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
python -m pip install tox
- name: Run Tests
run: tox -e py
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_ORG_TOKEN }}
file: ./coverage.xml
flags: Python_${{ steps.python-install.outputs.python-version }}
21 changes: 10 additions & 11 deletions bedevere/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ async def main(request):

async with aiohttp.ClientSession() as session:
gh = gh_aiohttp.GitHubAPI(session, "python/bedevere", cache=cache)
if not event.data.get("installation"):
return web.Response(text="Must be installed as an App.", status=400)
installation_id = event.data["installation"]["id"]
installation_access_token = await apps.get_installation_access_token(
gh,
installation_id=installation_id,
app_id=os.environ.get("GH_APP_ID"),
private_key=os.environ.get("GH_PRIVATE_KEY"),
)
gh.oauth_token = installation_access_token["token"]

if event.data.get("installation"):
# This path only works on GitHub App
installation_id = event.data["installation"]["id"]
installation_access_token = await apps.get_installation_access_token(
gh,
installation_id=installation_id,
app_id=os.environ.get("GH_APP_ID"),
private_key=os.environ.get("GH_PRIVATE_KEY"),
)
gh.oauth_token = installation_access_token["token"]
# Give GitHub some time to reach internal consistency.
await asyncio.sleep(1)
await router.dispatch(event, gh, session=session)
Expand All @@ -63,7 +63,6 @@ async def main(request):

@router.register("installation", action="created")
async def repo_installation_added(event, gh, *args, **kwargs):
# installation_id = event.data["installation"]["id"]
print(
f"App installed by {event.data['installation']['account']['login']}, installation_id: {event.data['installation']['id']}"
)
Expand Down
2 changes: 1 addition & 1 deletion bedevere/backport.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

async def _copy_over_labels(gh, original_issue, backport_issue):
"""Copy over relevant labels from the original PR to the backport PR."""
label_prefixes = "skip", "type", "sprint"
label_prefixes = "skip", "type", "sprint", "topic"
labels = list(
filter(lambda x: x.startswith(label_prefixes), util.labels(original_issue))
)
Expand Down
2 changes: 1 addition & 1 deletion bedevere/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

HELP = f"""\
Most changes to Python [require a NEWS entry]\
(https://devguide.python.org/committing/#updating-news-and-what-s-new-in-python). \
(https://devguide.python.org/core-developers/committing/#updating-news-and-what-s-new-in-python). \
Add one using the [blurb_it]({BLURB_IT_URL}) web app or \
the [blurb]({BLURB_PYPI_URL}) command-line tool.
Expand Down
6 changes: 3 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements.txt
asynctest==0.13.0
pytest==7.4.4
pytest-asyncio==0.23.2
pytest==8.2.1
pytest-asyncio==0.23.7
pytest-aiohttp==1.0.5
pytest-cov==4.1.0
pytest-cov==5.0.0
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
aiohttp==3.9.1
aiohttp==3.9.5
appdirs==1.4.4
async-timeout==4.0.3
cachetools==5.3.2
cachetools==5.3.3
chardet==5.2.0
gidgethub==5.3.0
multidict==6.0.4
packaging==23.2
pyparsing==3.1.1
multidict==6.0.5
packaging==24.0
pyparsing==3.1.2
six==1.16.0
uritemplate==4.1.1
yarl==1.9.4
sentry-sdk==1.39.1
sentry-sdk==2.3.1
5 changes: 3 additions & 2 deletions tests/test___main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async def test_ping(aiohttp_client):
assert response.status == 200


async def test_success(aiohttp_client):
async def test_bad_request_if_no_installation(aiohttp_client):
app = web.Application()
app.router.add_post("/", main.main)
client = await aiohttp_client(app)
Expand All @@ -32,7 +32,8 @@ async def test_success(aiohttp_client):
# either.
data = {"action": "created"}
response = await client.post("/", headers=headers, json=data)
assert response.status == 200
assert response.status == 400
assert await response.text() == "Must be installed as an App."


async def test_failure(aiohttp_client):
Expand Down
15 changes: 13 additions & 2 deletions tests/test_backport.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,13 @@ async def test_label_copying(pr_prefix):
},
}
event = sansio.Event(event_data, event="pull_request", delivery_id="1")
labels_to_test = "CLA signed", "skip news", "type-enhancement", "sprint"
labels_to_test = (
"CLA signed",
"skip news",
"type-enhancement",
"sprint",
"topic-repl",
)
getitem_data = {
"https://api.github.com/issue/1234": {
"labels": [{"name": label} for label in labels_to_test],
Expand All @@ -293,7 +299,12 @@ async def test_label_copying(pr_prefix):
expected_post = None
for post in gh.post_:
if post[0] == "https://api.github.com/issue/1234/labels":
assert {"skip news", "type-enhancement", "sprint"} == frozenset(post[1])
assert {
"skip news",
"type-enhancement",
"sprint",
"topic-repl",
} == frozenset(post[1])
expected_post = post

assert expected_post is not None
Expand Down
2 changes: 1 addition & 1 deletion tests/test_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ async def test_new_commit_pushed_to_not_approved_pr(issue_url_key, repo_full_nam

async def test_pushed_without_commits():
# There is new commit on approved PR
sha = "f2393593c99dd2d3ab8bfab6fcc5ddee540518a9"

data = {"commits": []}
event = sansio.Event(data, event="push", delivery_id="12345")
gh = FakeGH()
Expand Down

0 comments on commit 59dd6f8

Please sign in to comment.