Update CI config, minimum ruff version, docs and add changelog note

This commit is contained in:
Šarūnas Nejus 2024-11-17 02:58:55 +00:00
parent 88deb07890
commit 7be8f9c97a
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435
8 changed files with 64 additions and 38 deletions

View file

@ -14,10 +14,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: [ubuntu-latest, windows-latest] platform: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9"] python-version: ["3.9"]
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
env: env:
IS_MAIN_PYTHON: ${{ matrix.python-version == '3.8' && matrix.platform == 'ubuntu-latest' }} IS_MAIN_PYTHON: ${{ matrix.python-version == '3.9' && matrix.platform == 'ubuntu-latest' }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Python tools - name: Install Python tools

View file

@ -7,7 +7,7 @@ on:
- master - master
env: env:
PYTHON_VERSION: 3.8 PYTHON_VERSION: 3.9
jobs: jobs:
changed-files: changed-files:
@ -131,7 +131,7 @@ jobs:
run: echo "::add-matcher::.github/sphinx-problem-matcher.json" run: echo "::add-matcher::.github/sphinx-problem-matcher.json"
- name: Build docs - name: Build docs
run: | run: |-
poe docs |& tee /tmp/output poe docs |& tee /tmp/output
# fail the job if there are issues # fail the job if there are issues
grep -q " WARNING:" /tmp/output && exit 1 || exit 0 grep -q " WARNING:" /tmp/output && exit 1 || exit 0

View file

@ -118,10 +118,10 @@ command. Instead, you can activate the virtual environment in your shell with::
$ poetry shell $ poetry shell
You should see ``(beets-py38)`` prefix in your shell prompt. Now you can run You should see ``(beets-py3.9)`` prefix in your shell prompt. Now you can run
commands directly, for example:: commands directly, for example::
$ (beets-py38) pytest $ (beets-py3.9) pytest
Additionally, `poethepoet`_ task runner assists us with the most common Additionally, `poethepoet`_ task runner assists us with the most common
operations. Formatting, linting, testing are defined as ``poe`` tasks in operations. Formatting, linting, testing are defined as ``poe`` tasks in

View file

@ -6,6 +6,9 @@ Changelog goes here! Please add your entry to the bottom of one of the lists bel
Unreleased Unreleased
---------- ----------
Beets now requires Python 3.9 or later since support for EOL Python 3.8 has
been dropped.
New features: New features:
Bug fixes: Bug fixes:
@ -19,6 +22,8 @@ Bug fixes:
For packagers: For packagers:
* The minimum supported Python version is now 3.9.
Other changes: Other changes:
* Release workflow: fix the issue where the new release tag is created for the * Release workflow: fix the issue where the new release tag is created for the
@ -46,8 +51,6 @@ Bug fixes:
* Bring back test files and the manual to the source distribution tarball. * Bring back test files and the manual to the source distribution tarball.
:bug:`5513` :bug:`5513`
For packagers:
Other changes: Other changes:
* Changed `bitesize` label to `good first issue`. Our `contribute`_ page is now * Changed `bitesize` label to `good first issue`. Our `contribute`_ page is now

View file

@ -240,7 +240,7 @@ done
interpreter = "zsh" interpreter = "zsh"
[tool.ruff] [tool.ruff]
target-version = "py38" target-version = "py39"
line-length = 80 line-length = 80
[tool.ruff.lint] [tool.ruff.lint]

View file

@ -87,23 +87,29 @@ class AdvancedRewritePluginTest(PluginTestCase):
assert item.artists == ["유빈", "미미"] assert item.artists == ["유빈", "미미"]
def test_fail_when_replacements_empty(self): def test_fail_when_replacements_empty(self):
with pytest.raises( with (
UserError, pytest.raises(
match="Advanced rewrites must have at least one replacement", UserError,
), self.configure_plugin([{"match": "artist:A", "replacements": {}}]): match="Advanced rewrites must have at least one replacement",
),
self.configure_plugin([{"match": "artist:A", "replacements": {}}]),
):
pass pass
def test_fail_when_rewriting_single_valued_field_with_list(self): def test_fail_when_rewriting_single_valued_field_with_list(self):
with pytest.raises( with (
UserError, pytest.raises(
match="Field artist is not a multi-valued field but a list was given: C, D", UserError,
), self.configure_plugin( match="Field artist is not a multi-valued field but a list was given: C, D", # noqa: E501
[ ),
{ self.configure_plugin(
"match": "artist:'A & B'", [
"replacements": {"artist": ["C", "D"]}, {
}, "match": "artist:'A & B'",
] "replacements": {"artist": ["C", "D"]},
},
]
),
): ):
pass pass

View file

@ -102,9 +102,12 @@ class ZeroPluginTest(PluginTestCase):
item.write() item.write()
item_id = item.id item_id = item.id
with self.configure_plugin( with (
{"fields": ["comments"], "update_database": True, "auto": False} self.configure_plugin(
), control_stdin("y"): {"fields": ["comments"], "update_database": True, "auto": False}
),
control_stdin("y"),
):
self.run_command("zero") self.run_command("zero")
mf = MediaFile(syspath(item.path)) mf = MediaFile(syspath(item.path))
@ -122,9 +125,16 @@ class ZeroPluginTest(PluginTestCase):
item.write() item.write()
item_id = item.id item_id = item.id
with self.configure_plugin( with (
{"fields": ["comments"], "update_database": False, "auto": False} self.configure_plugin(
), control_stdin("y"): {
"fields": ["comments"],
"update_database": False,
"auto": False,
}
),
control_stdin("y"),
):
self.run_command("zero") self.run_command("zero")
mf = MediaFile(syspath(item.path)) mf = MediaFile(syspath(item.path))
@ -193,9 +203,12 @@ class ZeroPluginTest(PluginTestCase):
item_id = item.id item_id = item.id
with self.configure_plugin( with (
{"fields": ["year"], "keep_fields": ["comments"]} self.configure_plugin(
), control_stdin("y"): {"fields": ["year"], "keep_fields": ["comments"]}
),
control_stdin("y"),
):
self.run_command("zero") self.run_command("zero")
item = self.lib.get_item(item_id) item = self.lib.get_item(item_id)
@ -242,9 +255,12 @@ class ZeroPluginTest(PluginTestCase):
) )
item.write() item.write()
item_id = item.id item_id = item.id
with self.configure_plugin( with (
{"fields": ["comments"], "update_database": True, "auto": False} self.configure_plugin(
), control_stdin("n"): {"fields": ["comments"], "update_database": True, "auto": False}
),
control_stdin("n"),
):
self.run_command("zero") self.run_command("zero")
mf = MediaFile(syspath(item.path)) mf = MediaFile(syspath(item.path))

View file

@ -112,9 +112,10 @@ class ConfigCommandTest(BeetsTestCase):
def test_config_editor_not_found(self): def test_config_editor_not_found(self):
msg_match = "Could not edit configuration.*here is problem" msg_match = "Could not edit configuration.*here is problem"
with patch( with (
"os.execlp", side_effect=OSError("here is problem") patch("os.execlp", side_effect=OSError("here is problem")),
), pytest.raises(ui.UserError, match=msg_match): pytest.raises(ui.UserError, match=msg_match),
):
self.run_command("config", "-e") self.run_command("config", "-e")
def test_edit_invalid_config_file(self): def test_edit_invalid_config_file(self):