beets/test/plugins/test_autobpm.py
Šarūnas Nejus b683cb6540
Extend requires_import marker with force_ci option
Add force_ci kwarg to requires_import pytest marker to allow tests
to run unconditionally in CI (GitHub Actions), even if the module
is not detected locally. Refactor autobpm test to use this instead
of manual env-checking at module level.
2026-03-08 08:19:55 +00:00

41 lines
971 B
Python

import pytest
from beets.test.helper import ImportHelper, PluginMixin
pytestmark = pytest.mark.requires_import("librosa")
class TestAutoBPMPlugin(PluginMixin, ImportHelper):
plugin = "autobpm"
@pytest.fixture(scope="class", name="lib")
def fixture_lib(self):
self.setup_beets()
yield self.lib
self.teardown_beets()
@pytest.fixture(scope="class")
def item(self):
return self.add_item_fixture()
@pytest.fixture(scope="class")
def importer(self, lib):
self.import_media = []
self.prepare_album_for_import(1)
track = self.import_media[0]
track.bpm = None
track.save()
return self.setup_importer(autotag=False)
def test_command(self, lib, item):
self.run_command("autobpm", lib=lib)
item.load()
assert item.bpm == 117
def test_import(self, lib, importer):
importer.run()
assert lib.items().get().bpm == 117