Debian Codegraph @

test/extra/test_release.py

raw
1 """Tests for the release utils."""
2
3 import shutil
4 import sys
5
6 import pytest
7
8 from beets.test.helper import RUNNING_IN_CI
9
10 release = pytest.importorskip("extra.release")
11
12
13 pytestmark = pytest.mark.skipif(
14 not (
15 (RUNNING_IN_CI and sys.platform != "win32")
16 or bool(shutil.which("pandoc"))
17 ),
18 reason="pandoc isn't available",
19 )
20
21
22 @pytest.fixture
23 def rst_changelog():
24 return """
25 Unreleased
26 ----------
27
28 New features
29 ~~~~~~~~~~~~
30
31 - :doc:`/plugins/substitute`: Some substitute
32 multi-line change.
33 :bug:`5467`
34 - :ref:`list-cmd` Update.
35 - |BeetsPlugin| Some plugin change.
36 - See :class:`~beetsplug._utils.musicbrainz.MusicBrainzAPI` for documentation.
37 - See :class:`~nonexisting_ref` for non-existing reference.
38 - See :ref:`Nice title <nonexisting_ref>` for non-existing named reference.
39
40 You can do something with this command:
41
42 ::
43
44 $ do-something
45
46 Bug fixes
47 ~~~~~~~~~
48
49 - Some fix that refers to an issue.
50 :bug:`5467`
51 - Some fix that mentions user :user:`username`.
52 - Some fix thanks to
53 :user:`username`. :bug:`5467`
54 - Some fix with its own bullet points using incorrect indentation:
55
56 - First nested bullet point
57 with some text that wraps to the next line
58 - Second nested bullet point
59
60 - Another fix with an enumerated list
61
62 1. First
63 and some details
64 2. Second
65 and some details
66
67 Long parapgraph naaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmmmmmeeeeeeeeeeeeeee ending
68 with a colon:
69
70 .. For plugin developers
71 .. ~~~~~~~~~~~~~~~~~~~~~
72
73 Other changes
74 ~~~~~~~~~~~~~
75
76 - Changed ``bitesize`` label to ``good first issue``. Our `contribute`_ page is now
77 automatically populated with these issues. :bug:`4855`
78
79 .. _contribute: https://github.com/beetbox/beets/contribute
80
81 2.1.0 (November 22, 2024)
82 -------------------------
83
84 Bug fixes
85 ~~~~~~~~~
86
87 - Fixed something."""
88
89
90 @pytest.fixture
91 def md_changelog():
92 return r"""# Unreleased
93
94 ## New features
95
96 - [beets.plugins.BeetsPlugin](https://beets.readthedocs.io/en/stable/api/generated/beets.plugins.BeetsPlugin.html#beets.plugins.BeetsPlugin) Some plugin change.
97 - [list command](https://beets.readthedocs.io/en/stable/reference/cli.html#list-cmd) Update.
98 - [Substitute Plugin](https://beets.readthedocs.io/en/stable/plugins/substitute.html): Some substitute multi-line change. :bug: (#5467)
99 - See [beetsplug.\_utils.musicbrainz.MusicBrainzAPI](https://beets.readthedocs.io/en/stable/api/generated/beetsplug._utils.musicbrainz.MusicBrainzAPI.html#beetsplug._utils.musicbrainz.MusicBrainzAPI) for documentation.
100 - See `Nice title` for non-existing named reference.
101 - See `nonexisting_ref` for non-existing reference.
102
103 You can do something with this command:
104
105 $ do-something
106
107 ## Bug fixes
108
109 - Another fix with an enumerated list
110 1. First and some details
111 2. Second and some details
112 - Some fix thanks to @username. :bug: (#5467)
113 - Some fix that mentions user @username.
114 - Some fix that refers to an issue. :bug: (#5467)
115 - Some fix with its own bullet points using incorrect indentation:
116 - First nested bullet point with some text that wraps to the next line
117 - Second nested bullet point
118
119 Long parapgraph naaaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmmmmmmeeeeeeeeeeeeeee ending with a colon:
120
121 ## Other changes
122
123 - 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)
124
125 # 2.1.0 (November 22, 2024)
126
127 ## Bug fixes
128
129 - Fixed something.""" # noqa: E501
130
131
132 def test_convert_rst_to_md(rst_changelog, md_changelog):
133 actual = release.changelog_as_markdown(rst_changelog)
134
135 assert actual == md_changelog