File: test_release.py

package info (click to toggle)
beets 2.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,016 kB
  • sloc: python: 46,429; javascript: 8,018; xml: 334; sh: 261; makefile: 125
file content (115 lines) | stat: -rw-r--r-- 2,749 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
"""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.

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

- [Substitute Plugin](https://beets.readthedocs.io/en/stable/plugins/substitute.html): Some substitute multi-line change. :bug: (#5467)
- [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