Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion semantic_release/changelog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def markdown_changelog(
:param header: A boolean that decides whether a version number header should be included.
:return: The markdown formatted changelog.
"""
output = f"## v{version}\n" if header else ""
output = f"## v{version}\n\n" if header else ""

# Add the output of each component separated by a blank line
output += "\n\n".join(
Expand Down
2 changes: 1 addition & 1 deletion semantic_release/changelog/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def changelog_headers(

for section in get_changelog_sections(changelog, changelog_sections):
# Add a header for this section
output += f"\n### {section.capitalize()}\n"
output += f"\n### {section.capitalize()}\n\n"

# Add each commit from the section in an unordered list
for item in changelog[section]:
Expand Down
31 changes: 25 additions & 6 deletions tests/test_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,45 @@ def test_markdown_changelog():
},
) == (
# Expected output with the default configuration
"### Feature\n"
"### Feature\n\n"
"* Add non-breaking super-feature ([`145`](https://github.com/owner/repo_name/"
"commit/145))\n"
"* Add super-feature ([`134`](https://github.com/owner/repo_name/commit/134))\n"
"\n"
"### Fix\n"
"### Fix\n\n"
"* Fix bug in super-feature ([#15](https://github.com/owner/repo_name/issues/15))"
" ([`234`](https://github.com/owner/repo_name/"
"commit/234))\n"
"\n"
"### Breaking\n"
"### Breaking\n\n"
"* Uses super-feature as default instead of dull-feature."
" ([`21`](https://github.com/owner/repo_name/commit/21))\n"
"\n"
"### Documentation\n"
"### Documentation\n\n"
"* Document super-feature ([#189](https://github.com/owner/repo_name/issues/189))"
" ([`0`](https://github.com/owner/repo_name/commit/0))"
)


def test_markdown_changelog_with_header():
assert markdown_changelog(
"owner",
"repo_name",
"1.0.1",
{
"fix": [("234", "Fix bug in super-feature (#15)")],
},
header=True,
) == (
# Expected output with the default configuration
"## v1.0.1\n\n"
"### Fix\n\n"
"* Fix bug in super-feature ([#15](https://github.com/owner/repo_name/issues/15))"
" ([`234`](https://github.com/owner/repo_name/"
"commit/234))"
)


def test_markdown_changelog_gitlab():
with mock.patch(
"semantic_release.changelog.config.get", wrapped_config_get(hvcs="gitlab")
Expand All @@ -71,14 +90,14 @@ def test_markdown_changelog_gitlab():
},
) == (
# Expected output with the default configuration
"### Feature\n"
"### Feature\n\n"
"* Add non-breaking super-feature ([#1](https://gitlab.com/owner/"
"repo_name/-/issues/1)) ([`145`](https://gitlab.com/owner/"
"repo_name/-/commit/145))\n"
"* Add super-feature ([`134`](https://gitlab.com/owner/repo_name/-/"
"commit/134))\n"
"\n"
"### Documentation\n"
"### Documentation\n\n"
"* Document super-feature ([#189](https://gitlab.com/owner/repo_name/"
"-/issues/189)) ([`0`](https://gitlab.com/owner/repo_name/"
"-/commit/0))"
Expand Down