Skip to content

Commit

Permalink
autobpm: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snejus committed Aug 16, 2024
1 parent 0601026 commit 238ba9c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/plugins/test_autobpm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import pytest

from beets.test.helper import ImportHelper, PluginMixin


class TestAutoBPMPlugin(PluginMixin, ImportHelper):
plugin = "autobpm"

@pytest.fixture(scope="class", name="lib")
def fixture_lib(self):
self.setup_beets()
self.load_plugins()

return self.lib

@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

0 comments on commit 238ba9c

Please sign in to comment.