Skip to content

Commit d4b67aa

Browse files
authored
Allow gh-issue 0 for "no changes" release entries (#92)
2 parents 192da5f + 9525174 commit d4b67aa

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.2.0
4+
5+
* Allow `gh-issue 0` for "no changes" release entries by @hugovk in https://github.com/python/blurb/pull/92
6+
37
## 2.1.0
48

59
* Add support for Python 3.15 by @hugovk in https://github.com/python/blurb/pull/74

‎src/blurb/_blurb_file.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ def finish_entry() -> None:
151151
except (TypeError, ValueError):
152152
throw(f'Invalid {issue_keys[key]} number: {value!r}')
153153

154-
if key == 'gh-issue' and int(value) < lowest_possible_gh_issue_number:
154+
if (
155+
key == 'gh-issue'
156+
and not no_changes
157+
and int(value) < lowest_possible_gh_issue_number
158+
):
155159
throw(
156160
f'Invalid gh-issue number: {value!r} (must be >= {lowest_possible_gh_issue_number})'
157161
)

‎tests/test_blurb_file.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,26 @@ def test_parse():
9797
assert body == 'Hello world!\n'
9898

9999

100+
def test_parse_no_changes():
101+
# Arrange
102+
contents = (
103+
'.. gh-issue: 0\n'
104+
'.. no changes: True\n'
105+
'.. section: Library\n'
106+
'There were no new changes in version 3.15.0.'
107+
)
108+
blurbs = Blurbs()
109+
110+
# Act
111+
blurbs.parse(contents)
112+
113+
# Assert
114+
metadata, body = blurbs[0]
115+
assert metadata['gh-issue'] == '0'
116+
assert metadata['no changes'] == 'True'
117+
assert body == 'There were no new changes in version 3.15.0.\n'
118+
119+
100120
@pytest.mark.parametrize(
101121
'contents, expected_error',
102122
(

0 commit comments

Comments
 (0)