From d42c04ceb0aed79feff13fb438c82a5396f74334 Mon Sep 17 00:00:00 2001 From: Nicholas Wiltsie Date: Fri, 27 Sep 2024 15:49:49 -0700 Subject: [PATCH] s/IneligibleAlias/IneligibleAliasError --- bumpchanges/alias.py | 6 ++++-- tests/test_aliases.py | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bumpchanges/alias.py b/bumpchanges/alias.py index 4eace5f..ed144ea 100644 --- a/bumpchanges/alias.py +++ b/bumpchanges/alias.py @@ -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. @@ -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) diff --git a/tests/test_aliases.py b/tests/test_aliases.py index 738ae8e..790cc96 100644 --- a/tests/test_aliases.py +++ b/tests/test_aliases.py @@ -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 @@ -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) @@ -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 @@ -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()