Skip to content

Commit

Permalink
test: kill a continue/break mutant
Browse files Browse the repository at this point in the history
  • Loading branch information
Ned Batchelder committed Apr 30, 2023
1 parent 954bdcb commit 4aa3bef
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions tests/test_ghrel.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@
A beginning
v0.1 -- 2010-01-01
------------------
Didn't bother to tag this one.
v0.0.1 -- 2001-01-01
--------------------
Didn't bother to tag this one.
Very first.
"""

RELEASES1 = {
Expand All @@ -45,6 +51,10 @@
"url": "https://api.github.com/repos/joe/project/releases/123",
"body": "original body",
},
"v0.0.1": {
"url": "https://api.github.com/repos/joe/project/releases/123",
"body": "original body",
},
}

V123_REL = {
Expand All @@ -63,12 +73,20 @@
"prerelease": True,
}

V001_REL = {
"body": "Very first.\n",
"name": "v0.0.1",
"tag_name": "v0.0.1",
"draft": False,
"prerelease": False,
}


@pytest.fixture()
def scenario1(temp_dir, fake_git, mocker):
"""A common scenario for the tests."""
fake_git.add_remote("origin", "[email protected]:joe/project.git")
fake_git.add_tags(["v1.2.3", "v1.0", "v0.9a7"])
fake_git.add_tags(["v1.2.3", "v1.0", "v0.9a7", "v0.0.1"])
(temp_dir / "CHANGELOG.rst").write_text(CHANGELOG1)
mock_get_releases = mocker.patch("scriv.ghrel.get_releases")
mock_get_releases.return_value = RELEASES1
Expand Down Expand Up @@ -128,6 +146,7 @@ def test_dash_all(
assert mock_create_release.mock_calls == [call("joe/project", V123_REL)]
assert mock_update_release.mock_calls == [
call(RELEASES1["v0.9a7"], V097_REL),
call(RELEASES1["v0.0.1"], V001_REL),
]
assert caplog.record_tuples == [
(
Expand All @@ -143,7 +162,7 @@ def test_dash_all(
(
"scriv.ghrel",
logging.WARNING,
"Version v0.0.1 has no tag. No release will be made.",
"Version v0.1 has no tag. No release will be made.",
),
]

Expand Down Expand Up @@ -213,8 +232,10 @@ def test_dash_all_dry_run(cli_invoke, scenario1, no_actions, caplog):
(
"scriv.ghrel",
logging.WARNING,
"Version v0.0.1 has no tag. No release will be made.",
"Version v0.1 has no tag. No release will be made.",
),
("scriv.ghrel", 20, "Would update release v0.0.1"),
("scriv.ghrel", 20, "Body:\nVery first.\n"),
]


Expand Down

0 comments on commit 4aa3bef

Please sign in to comment.