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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.2.0

* Allow `gh-issue 0` for "no changes" release entries by @hugovk in https://github.com/python/blurb/pull/92

## 2.1.0

* Add support for Python 3.15 by @hugovk in https://github.com/python/blurb/pull/74
Expand Down
6 changes: 5 additions & 1 deletion src/blurb/_blurb_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ def finish_entry() -> None:
except (TypeError, ValueError):
throw(f'Invalid {issue_keys[key]} number: {value!r}')

if key == 'gh-issue' and int(value) < lowest_possible_gh_issue_number:
if (
key == 'gh-issue'
and not no_changes
and int(value) < lowest_possible_gh_issue_number
):
throw(
f'Invalid gh-issue number: {value!r} (must be >= {lowest_possible_gh_issue_number})'
)
Expand Down
20 changes: 20 additions & 0 deletions tests/test_blurb_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,26 @@ def test_parse():
assert body == 'Hello world!\n'


def test_parse_no_changes():
# Arrange
contents = (
'.. gh-issue: 0\n'
'.. no changes: True\n'
'.. section: Library\n'
'There were no new changes in version 3.15.0.'
)
blurbs = Blurbs()

# Act
blurbs.parse(contents)

# Assert
metadata, body = blurbs[0]
assert metadata['gh-issue'] == '0'
assert metadata['no changes'] == 'True'
assert body == 'There were no new changes in version 3.15.0.\n'


@pytest.mark.parametrize(
'contents, expected_error',
(
Expand Down
Loading