This repository has been archived by the owner on Jun 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support a header in the changelog (#30)
This will prevent Sphinx from listing every changelog entry as a separate page (see gidgethub/gidgethub#118 for details).
- Loading branch information
1 parent
5425512
commit 3e94336
Showing
5 changed files
with
112 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,35 @@ | ||
# 0.5.0 | ||
# Changelog | ||
|
||
## 0.5.0 | ||
[PR #29](https://github.com/brettcannon/release-often/pull/29): Make main() async (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.4.7 | ||
## 0.4.7 | ||
[PR #27](https://github.com/brettcannon/release-often/pull/27): Fix a name (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.4.6 | ||
## 0.4.6 | ||
Set `PYTHONPATH` in the container | ||
|
||
# 0.4.5 | ||
## 0.4.5 | ||
[PR #24](https://github.com/brettcannon/release-often/pull/24): Use ADD properly to copy source files into the container (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.4.4 | ||
## 0.4.4 | ||
[PR #23](https://github.com/brettcannon/release-often/pull/23): Return the created changelog entry (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.4.3 | ||
## 0.4.3 | ||
[PR #22](https://github.com/brettcannon/release-often/pull/22): Fix an httpx reference (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.4.2 | ||
## 0.4.2 | ||
[PR #21](https://github.com/brettcannon/release-often/pull/21): trio.run() does not accept keyword-only arguments (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.4.1 | ||
## 0.4.1 | ||
[PR #20](https://github.com/brettcannon/release-often/pull/20): Index off the pull request event appropriately (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.4.0 | ||
## 0.4.0 | ||
[PR #19](https://github.com/brettcannon/release-often/pull/19): Create release after uploading (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.3.0 | ||
## 0.3.0 | ||
[PR #18](https://github.com/brettcannon/release-often/pull/18): Support uploading to PyPI (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
||
# 0.2.0 | ||
## 0.2.0 | ||
[PR #17](https://github.com/brettcannon/release-often/pull/17): Run 'git push' (thanks [brettcannon](https://github.com/brettcannon)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,75 @@ | ||
import json | ||
|
||
import pytest | ||
|
||
from release_often import changelog | ||
|
||
|
||
file_extensions = pytest.mark.parametrize("file_extension", [".md", ".rst"]) | ||
|
||
|
||
@file_extensions | ||
def test_templates(file_extension): | ||
template = changelog.TEMPLATES[file_extension] | ||
details = { | ||
"version": "1.2.3", | ||
"pr_number": "42", | ||
"pr_url": "https://github.com/brettcannon/release-often/pull/42", | ||
"summary": "A thing changed!", | ||
"committer": "Andrea McInnes", | ||
"committer_url": "https://github.com/andreamcinnes", | ||
} | ||
entry = template.format_map(details) | ||
for detail in details.values(): | ||
assert detail in entry | ||
|
||
|
||
@file_extensions | ||
def test_entry(pr_event, file_extension): | ||
version = "2.0.0" | ||
entry = changelog.entry(file_extension, version, pr_event) | ||
assert version in entry | ||
assert "105" in entry | ||
assert "https://github.com/brettcannon/gidgethub/pull/105" in entry | ||
assert "Update the copyright year in documentation." in entry | ||
assert "Mariatta" in entry | ||
assert "https://github.com/Mariatta" in entry | ||
OLD_RST_CHANGELOG = """\ | ||
Changelog | ||
========= | ||
1.0.0 | ||
------------------------------------------------- | ||
`PR #1 <...>`_: I did something! (thanks `Brett <...>`_) | ||
""" | ||
|
||
NEW_RST_CHANGELOG = """\ | ||
Changelog | ||
========= | ||
2.0.0 | ||
------------------------------------------------- | ||
`PR #105 <https://github.com/brettcannon/gidgethub/pull/105>`_: Update the copyright year in documentation. (thanks `Mariatta <https://github.com/Mariatta>`_) | ||
1.0.0 | ||
------------------------------------------------- | ||
`PR #1 <...>`_: I did something! (thanks `Brett <...>`_) | ||
""" | ||
|
||
OLD_MD_CHANGELOG = """\ | ||
# Changelog | ||
## 1.0.0 | ||
------------------------------------------------- | ||
[PR #1]()...): I did something! (thanks [Brett](...)) | ||
""" | ||
|
||
NEW_MD_CHANGELOG = """\ | ||
# Changelog | ||
## 2.0.0 | ||
[PR #105](https://github.com/brettcannon/gidgethub/pull/105): Update the copyright year in documentation. (thanks [Mariatta](https://github.com/Mariatta)) | ||
## 1.0.0 | ||
------------------------------------------------- | ||
[PR #1]()...): I did something! (thanks [Brett](...)) | ||
""" | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"file_extension,old_changelog,expect", | ||
[ | ||
(".rst", OLD_RST_CHANGELOG, NEW_RST_CHANGELOG), | ||
(".md", OLD_MD_CHANGELOG, NEW_MD_CHANGELOG), | ||
], | ||
) | ||
def test_update(pr_event, file_extension, old_changelog, expect): | ||
new_changelog = changelog.update(old_changelog, file_extension, "2.0.0", pr_event) | ||
assert new_changelog == expect | ||
|
||
|
||
def test_bad_header(pr_event): | ||
with pytest.raises(ValueError): | ||
changelog.update("I have no header!", ".md", "2.0.0", pr_event) | ||
|
||
|
||
SINGLE_ENTRY = """\ | ||
# Changelog | ||
## 2.0.0 | ||
[PR #105](https://github.com/brettcannon/gidgethub/pull/105): Update the copyright year in documentation. (thanks [Mariatta](https://github.com/Mariatta)) | ||
""" | ||
|
||
|
||
def test_no_header(pr_event): | ||
expect = changelog.update("", ".md", "2.0.0", pr_event) | ||
assert SINGLE_ENTRY == expect |