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
AA-Turner authored Jan 20, 2024
2 parents 5779cbf + 246591e commit 00d52ed
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
id: python-install
with:
python-version: ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions bedevere/prtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async def classify_by_filepaths(gh, pull_request, filenames):
if util.is_news_dir(filename):
news = True
filepath = pathlib.PurePath(filename)
if filepath.suffix == ".rst":
if filepath.suffix == ".rst" or filepath.name == ".nitignore":
docs = True
elif filepath.name.startswith("test_"):
elif filepath.name.startswith(("test_", "_test")):
tests = True
else:
return pr_labels
Expand Down
4 changes: 2 additions & 2 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.3
pytest-asyncio==0.21.1
pytest==7.4.4
pytest-asyncio==0.23.2
pytest-aiohttp==1.0.5
pytest-cov==4.1.0
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ packaging==23.2
pyparsing==3.1.1
six==1.16.0
uritemplate==4.1.1
yarl==1.9.3
sentry-sdk==1.38.0
yarl==1.9.4
sentry-sdk==1.39.1
40 changes: 40 additions & 0 deletions tests/test_prtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ async def test_docs_no_news():
assert gh.post_data[0] == [Labels.docs.value, Labels.skip_news.value]


async def test_docs_no_news_with_dotnitignore():
filenames = {"path/to/docs1.rst", "path/to/.nitignore"}
issue = {"labels": [], "labels_url": "https://api.github.com/some/label"}
gh = FakeGH(getitem=issue)
event_data = {
"action": "opened",
"number": 1234,
"pull_request": {
"url": "https://api.github.com/repos/cpython/python/pulls/1234",
"statuses_url": "https://api.github.com/some/status",
"issue_url": "https://api.github.com/repos/cpython/python/issue/1234",
},
}
await prtype.classify_by_filepaths(gh, event_data["pull_request"], filenames)
assert gh.getitem_url == "https://api.github.com/repos/cpython/python/issue/1234"
assert len(gh.post_url) == 1
assert gh.post_url[0] == "https://api.github.com/some/label"
assert gh.post_data[0] == [Labels.docs.value, Labels.skip_news.value]


async def test_docs_and_news():
filenames = {"/path/to/docs1.rst", f"Misc/NEWS.d/next/Lib/{GOOD_BASENAME}"}
issue = {"labels": [], "labels_url": "https://api.github.com/some/label"}
Expand Down Expand Up @@ -125,6 +145,26 @@ async def test_tests_only():
assert gh.post_data[0] == [Labels.tests.value]


async def test_tests_and_testmods_only():
filenames = {"/path/to/_testmod.c", "_test_module.c", "test_capi,py"}
issue = {"labels": [], "labels_url": "https://api.github.com/some/label"}
gh = FakeGH(getitem=issue)
event_data = {
"action": "opened",
"number": 1234,
"pull_request": {
"url": "https://api.github.com/repos/cpython/python/pulls/1234",
"statuses_url": "https://api.github.com/some/status",
"issue_url": "https://api.github.com/repos/cpython/python/issue/1234",
},
}
await prtype.classify_by_filepaths(gh, event_data["pull_request"], filenames)
assert gh.getitem_url == "https://api.github.com/repos/cpython/python/issue/1234"
assert len(gh.post_url) == 1
assert gh.post_url[0] == "https://api.github.com/some/label"
assert gh.post_data[0] == [Labels.tests.value]


async def test_docs_and_tests():
filenames = {"/path/to/docs.rst", "test_docs2.py"}
issue = {
Expand Down

0 comments on commit 00d52ed

Please sign in to comment.