Skip to content

Commit

Permalink
Add the "docs" label for Doc/*/.nitignore (#617)
Browse files Browse the repository at this point in the history
Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
skirpichev and hugovk authored Jan 20, 2024
1 parent b5bcd24 commit df8d80f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bedevere/prtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ 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_"):
tests = True
Expand Down
20 changes: 20 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

0 comments on commit df8d80f

Please sign in to comment.