Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test empty changelog #243

Merged
merged 2 commits into from
Jan 19, 2022
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
6 changes: 5 additions & 1 deletion jupyter_releaser/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ def get_version_entry(
return f"## {version}\n\nNo merged PRs"

entry = md.replace("[full changelog]", "[Full Changelog]")
entry = entry.replace("...None", f"...{until}")

if until:
entry = entry.replace("...None", f"...{until}")
else:
entry = entry.replace("...None", "")

entry = entry.splitlines()[2:]

Expand Down
20 changes: 20 additions & 0 deletions jupyter_releaser/tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,26 @@ def test_get_changelog_version_entry_since_last_stable(py_package, mocker):
assert testutil.PR_ENTRY in resp


def test_get_empty_changelog(py_package, mocker):
mocked_gen = mocker.patch("jupyter_releaser.changelog.generate_activity_md")
mocked_gen.return_value = testutil.EMPTY_CHANGELOG_ENTRY
branch = "foo"
util.run("git branch baz/bar")
ref = "heads/baz/bar"
resp = changelog.get_version_entry(ref, branch, "baz/bar", "0.2.5", since="v0.2.4")
mocked_gen.assert_called_with(
"baz/bar",
since="v0.2.4",
until=None,
kind="pr",
branch=branch,
heading_level=2,
auth=None,
)

assert not ("...None" in resp)


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

Expand Down
11 changes: 11 additions & 0 deletions jupyter_releaser/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
[@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)
"""

EMPTY_CHANGELOG_ENTRY = """
## main@{2021-09-15}...main@{2022-01-18}

([Full Changelog](https://github.com/QuantStack/jupyterlab-js-logs/compare/v0.2.4...None))

### Contributors to this release

([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))

"""


def setup_cfg_template(package_name="foo", module_name=None):
return f"""
Expand Down