Skip to content

Commit 5bf4cf1

Browse files
author
Ned Batchelder
committed
fix: no fragments to collect now exits with 2. #110
1 parent 951c0f8 commit 5bf4cf1

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Changed
2+
.......
3+
4+
- If there are no changelog fragments, ``scriv collect`` now exits with status
5+
code of 2, fixing `issue 110`_.
6+
7+
.. _issue 110: https://github.com/nedbat/scriv/issues/110

src/scriv/collect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def collect(
5858
frags = scriv.fragments_to_combine()
5959
if not frags:
6060
logger.info("No changelog fragments to collect")
61-
return
61+
sys.exit(2)
6262

6363
changelog = scriv.changelog()
6464
changelog.read()

tests/test_collect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ def test_no_fragments(cli_invoke, changelog_d, temp_dir, caplog):
434434
(changelog_d / "README.rst").write_text("This directory has fragments")
435435
(temp_dir / "CHANGELOG.rst").write_text("Not much\n")
436436
with freezegun.freeze_time("2020-02-25T15:18:19"):
437-
cli_invoke(["collect"])
437+
result = cli_invoke(["collect"], expect_ok=False)
438+
assert result.exit_code == 2
438439
changelog_text = (temp_dir / "CHANGELOG.rst").read_text()
439440
assert changelog_text == "Not much\n"
440441
assert "No changelog fragments to collect" in caplog.text

0 commit comments

Comments
 (0)