Skip to content

Commit

Permalink
Ensure gh-issue or bpo exists in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Nov 9, 2024
1 parent 657a617 commit 04b6913
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/blurb/blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ def finish_entry():
if value not in sections:
throw(f"Invalid section {value!r}! You must use one of the predefined sections.")

if "gh-issue" not in metadata and "bpo" not in metadata:
throw("'gh-issue:' or 'bpo:' must be specified in the metadata!")

if not 'section' in metadata:
throw("No 'section' specified. You must provide one!")

Expand Down
4 changes: 4 additions & 0 deletions tests/test_blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ def test_parse():
".. gh-issue: 123456\n.. section: IDLE\n.. section: IDLE\nHello world!",
r"Blurb metadata sets 'section' twice!",
),
(
".. section: IDLE\nHello world!",
r"'gh-issue:' or 'bpo:' must be specified in the metadata!",
),
),
)
def test_parse_no_body(contents, expected_error):
Expand Down

0 comments on commit 04b6913

Please sign in to comment.