beets/test/test_release.py
Šarūnas Nejus 50959bb316
Fix rendering generated refs
This specifically fixes v2.6.0 changelog:

diff --git a/before b/after
index dc9a2ecd2..51303c65f 100644
--- a/before
+++ b/after
@@ -51,3 +51,3 @@ Beets now requires Python 3.10 or later since support for EOL Python 3.9 has bee

-- Added a reusable requests handler which can be used by plugins to make HTTP requests with built-in retry and backoff logic. It uses beets user-agent and configures timeouts. See `~beetsplug._utils.requests.RequestHandler` for documentation.
+- Added a reusable requests handler which can be used by plugins to make HTTP requests with built-in retry and backoff logic. It uses beets user-agent and configures timeouts. See [beetsplug.\_utils.requests.RequestHandler](https://beets.readthedocs.io/en/stable/api/generated/beetsplug._utils.requests.RequestHandler.html#beetsplug._utils.requests.RequestHandler) for documentation.

@@ -62,3 +62,3 @@ Beets now requires Python 3.10 or later since support for EOL Python 3.9 has bee

-  See `~beetsplug._utils.musicbrainz.MusicBrainzAPI` for documentation.
+  See [beetsplug.\_utils.musicbrainz.MusicBrainzAPI](https://beets.readthedocs.io/en/stable/api/generated/beetsplug._utils.musicbrainz.MusicBrainzAPI.html#beetsplug._utils.musicbrainz.MusicBrainzAPI) for documentation.
2026-02-08 07:20:44 +00:00

119 lines
3.2 KiB
Python

"""Tests for the release utils."""
import os
import shutil
import sys
import pytest
release = pytest.importorskip("extra.release")
pytestmark = pytest.mark.skipif(
not (
(os.environ.get("GITHUB_ACTIONS") == "true" and sys.platform != "win32")
or bool(shutil.which("pandoc"))
),
reason="pandoc isn't available",
)
@pytest.fixture
def rst_changelog():
return """New features:
- :doc:`/plugins/substitute`: Some substitute
multi-line change.
:bug:`5467`
- :ref:`list-cmd` Update.
- |BeetsPlugin| Some plugin change.
- See :class:`~beetsplug._utils.musicbrainz.MusicBrainzAPI` for documentation.
You can do something with this command:
::
$ do-something
Bug fixes:
- Some fix that refers to an issue.
:bug:`5467`
- Some fix that mentions user :user:`username`.
- Some fix thanks to
:user:`username`. :bug:`5467`
- Some fix with its own bullet points using incorrect indentation:
- First nested bullet point
with some text that wraps to the next line
- Second nested bullet point
- Another fix with an enumerated list
1. First
and some details
2. Second
and some details
Section naaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmmmmmeeeeeeeeeeeeeee with over 80
characters:
Empty section:
Other changes:
- Changed ``bitesize`` label to ``good first issue``. Our `contribute`_ page is now
automatically populated with these issues. :bug:`4855`
.. _contribute: https://github.com/beetbox/beets/contribute
2.1.0 (November 22, 2024)
-------------------------
Bug fixes:
- Fixed something."""
@pytest.fixture
def md_changelog():
return r"""### New features
- See [beetsplug.\_utils.musicbrainz.MusicBrainzAPI](https://beets.readthedocs.io/en/stable/api/generated/beetsplug._utils.musicbrainz.MusicBrainzAPI.html#beetsplug._utils.musicbrainz.MusicBrainzAPI) for documentation.
- [Substitute Plugin](https://beets.readthedocs.io/en/stable/plugins/substitute.html): Some substitute multi-line change. :bug: (#5467)
- [beets.plugins.BeetsPlugin](https://beets.readthedocs.io/en/stable/api/generated/beets.plugins.BeetsPlugin.html#beets.plugins.BeetsPlugin) Some plugin change.
- [list](https://beets.readthedocs.io/en/stable/reference/cli.html#list-cmd) Update.
You can do something with this command:
$ do-something
### Bug fixes
- Another fix with an enumerated list
1. First and some details
2. Second and some details
- Some fix thanks to @username. :bug: (#5467)
- Some fix that mentions user @username.
- Some fix that refers to an issue. :bug: (#5467)
- Some fix with its own bullet points using incorrect indentation:
- First nested bullet point with some text that wraps to the next line
- Second nested bullet point
**Section naaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmmmmmeeeeeeeeeeeeeee with over 80 characters**
### Other changes
- Changed `bitesize` label to `good first issue`. Our [contribute](https://github.com/beetbox/beets/contribute) page is now automatically populated with these issues. :bug: (#4855)
# 2.1.0 (November 22, 2024)
### Bug fixes
- Fixed something.""" # noqa: E501
def test_convert_rst_to_md(rst_changelog, md_changelog):
actual = release.changelog_as_markdown(rst_changelog)
assert actual == md_changelog