Skip to content

Commit

Permalink
Merge pull request #105 from bj00rn/main
Browse files Browse the repository at this point in the history
  • Loading branch information
ewjoachim authored Feb 15, 2023
2 parents b16547c + 2a8bd77 commit ad0a535
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sphinx_github_changelog/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def extract_pypi_package_name(url: Optional[str]) -> Optional[str]:
url_is_correct = stripped_url.startswith(prefix)
if not url_is_correct:
raise ChangelogError(
"Changelog needs a Github releases URL "
f"(https://github.com/:owner/:repo/releases). Received {url}"
"Changelog needs a PyPI project URL "
f"(https://pypi.org/project/:project). Received {url}"
)

return stripped_url[len(prefix) :] # noqa
Expand Down
8 changes: 6 additions & 2 deletions tests/unit/test_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ def test_extract_github_repo_name(url):


def test_extract_github_repo_name_error():
with pytest.raises(changelog.ChangelogError):
with pytest.raises(
changelog.ChangelogError, match="^Changelog needs a Github releases URL"
):
changelog.extract_github_repo_name("https://example.com")


Expand All @@ -123,7 +125,9 @@ def test_extract_pypi_package_name(url):


def test_extract_pypi_package_name_error():
with pytest.raises(changelog.ChangelogError):
with pytest.raises(
changelog.ChangelogError, match="^Changelog needs a PyPI project URL"
):
changelog.extract_pypi_package_name("https://example.com")


Expand Down

0 comments on commit ad0a535

Please sign in to comment.