Skip to content

Commit 15bcc5e

Browse files
committed
Test empty changelog
1 parent 9d9ec2f commit 15bcc5e

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

jupyter_releaser/changelog.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ def get_version_entry(
105105
return f"## {version}\n\nNo merged PRs"
106106

107107
entry = md.replace("[full changelog]", "[Full Changelog]")
108-
entry = entry.replace("...None", f"...{until}")
108+
109+
if until:
110+
entry = entry.replace("...None", f"...{until}")
111+
else:
112+
entry = entry.replace("...None", f"")
113+
109114

110115
entry = entry.splitlines()[2:]
111116

jupyter_releaser/tests/test_functions.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,27 @@ def test_get_changelog_version_entry_since_last_stable(py_package, mocker):
124124
assert f"## {version}" in resp
125125
assert testutil.PR_ENTRY in resp
126126

127+
def test_get_empty_changelog(py_package, mocker):
128+
mocked_gen = mocker.patch("jupyter_releaser.changelog.generate_activity_md")
129+
mocked_gen.return_value = testutil.EMPTY_CHANGELOG_ENTRY
130+
branch = "foo"
131+
util.run("git branch baz/bar")
132+
ref = "heads/baz/bar"
133+
resp = changelog.get_version_entry(
134+
ref, branch, "baz/bar", "0.2.5", since="v0.2.4"
135+
)
136+
mocked_gen.assert_called_with(
137+
"baz/bar",
138+
since="v0.2.4",
139+
until=None,
140+
kind="pr",
141+
branch=branch,
142+
heading_level=2,
143+
auth=None,
144+
)
145+
146+
assert not ("...None" in resp)
147+
127148

128149
def test_compute_sha256(py_package):
129150
assert len(util.compute_sha256(py_package / "CHANGELOG.md")) == 64

jupyter_releaser/tests/util.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
[@betatim](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Abetatim+updated%3A2019-09-01..2019-11-01&type=Issues) | [@choldgraf](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2019-09-01..2019-11-01&type=Issues) | [@consideRatio](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2019-09-01..2019-11-01&type=Issues)
4646
"""
4747

48+
EMPTY_CHANGELOG_ENTRY = f"""
49+
## main@{{2021-09-15}}...main@{{2022-01-18}}
50+
51+
([Full Changelog](https://github.com/QuantStack/jupyterlab-js-logs/compare/v0.2.4...None))
52+
53+
### Contributors to this release
54+
55+
([GitHub contributors page for this release](https://github.com/QuantStack/jupyterlab-js-logs/graphs/contributors?from=2021-09-15&to=2022-01-18&type=c))
56+
57+
"""
4858

4959
def setup_cfg_template(package_name="foo", module_name=None):
5060
return f"""

0 commit comments

Comments
 (0)