Skip to content

Commit

Permalink
s/IneligibleAlias/IneligibleAliasError
Browse files Browse the repository at this point in the history
  • Loading branch information
nwiltsie committed Sep 27, 2024
1 parent dad4001 commit d42c04c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions bumpchanges/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .utils import dereference_tags, tag_to_semver, get_github_releases, Release


class IneligibleAlias(Exception):
class IneligibleAliasError(Exception):
"""
Exception to major alias shouldn't be updated.
Expand Down Expand Up @@ -149,7 +149,9 @@ def compute_alias_action(self, major_version: int) -> tuple[str, str]:
eligible_tags.sort(key=lambda x: self.tag_to_version_map[x])

if not eligible_tags:
raise IneligibleAlias("No eligible release tags for alias `{target_alias}`")
raise IneligibleAliasError(
"No eligible release tags for alias `{target_alias}`"
)

target_tag = eligible_tags[-1]
self.logger.info("Alias `%s` should point to `%s`", target_alias, target_tag)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
import semver

from bumpchanges.alias import ReleaseAliaser, IneligibleAlias, AliasError, Release
from bumpchanges.alias import ReleaseAliaser, IneligibleAliasError, AliasError, Release


# Sample test case to mock _dereference_tags
Expand Down Expand Up @@ -46,7 +46,7 @@ def test_alias_workflow(aliaser):
assert aliaser.compute_alias_action(1) == ("v1", "v1.0.1")
assert aliaser.compute_alias_action(2) == ("v2", "v2.1.0")

with pytest.raises(IneligibleAlias):
with pytest.raises(IneligibleAliasError):
aliaser.compute_alias_action(3)


Expand All @@ -62,7 +62,7 @@ def test_modified_releases(aliaser):

# Act as if this GitHub release never existed. There are no more valid releases.
aliaser.tag_to_release_map.pop("v2.0.0")
with pytest.raises(IneligibleAlias):
with pytest.raises(IneligibleAliasError):
aliaser.compute_alias_action(2)

# Add in a new release
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_drafts_and_prereleases(aliaser, semver_pre, release_draft, release_pre)
aliaser._add_github_release(Release("", tag, release_draft, release_pre))

if semver_pre or release_pre or release_draft:
expectation = pytest.raises(IneligibleAlias)
expectation = pytest.raises(IneligibleAliasError)
else:
expectation = contextlib.nullcontext()

Expand Down

0 comments on commit d42c04c

Please sign in to comment.