Skip to content

Commit

Permalink
fix: always use full-version rtfd links #1566
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Feb 24, 2023
1 parent 2f81370 commit 857833e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 20,10 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------

Nothing yet.
- Fix: the PyPI page had broken links to documentation pages, but no longer
does, closing `issue 1566`_.

.. _issue 1566: https://github.com/nedbat/coveragepy/issues/1566


.. scriv-start-here
Expand Down
9 changes: 4 additions & 5 deletions coverage/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 40,10 @@ def _make_url(
dev: int = 0,
) -> str:
"""Make the URL people should start at for this version of coverage.py."""
url = "https://coverage.readthedocs.io"
if releaselevel != "final" or dev != 0:
# For pre-releases, use a version-specific URL.
url = "/en/" _make_version(major, minor, micro, releaselevel, serial, dev)
return url
return (
"https://coverage.readthedocs.io/en/"
_make_version(major, minor, micro, releaselevel, serial, dev)
)


__version__ = _make_version(*version_info, _dev)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 33,8 @@ def test_make_version(self) -> None:
assert _make_version(5, 10, 2, 'candidate', 7, 3) == "5.10.2rc7.dev3"

def test_make_url(self) -> None:
assert _make_url(4, 0, 0, 'final') == "https://coverage.readthedocs.io"
expected = "https://coverage.readthedocs.io/en/4.1.2"
assert _make_url(4, 1, 2, 'final') == expected
expected = "https://coverage.readthedocs.io/en/4.1.2b3"
assert _make_url(4, 1, 2, 'beta', 3) == expected
expected = "https://coverage.readthedocs.io/en/4.1.2b3.dev17"
Expand Down

0 comments on commit 857833e

Please sign in to comment.