Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion test/plugins/test_lastgenre.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ def test_sort_by_depth(self):
assert res == ["ambient", "electronic"]


@pytest.fixture
def config(config):
"""Provide a fresh beets configuration for every test/parameterize call
This is necessary to prevent the following parameterized test to bleed
config test state in between test cases.
"""
return config


@pytest.mark.parametrize(
"config_values, item_genre, mock_genres, expected_result",
[
Expand Down Expand Up @@ -232,6 +242,7 @@ def test_sort_by_depth(self):
"whitelist": True,
"canonical": False,
"prefer_specific": False,
"count": 10,
},
["original unknown", "Blues"],
{
Expand Down Expand Up @@ -264,6 +275,7 @@ def test_sort_by_depth(self):
"whitelist": True,
"canonical": False,
"prefer_specific": False,
"count": 10,
},
["original unknown", "Blues"],
{
Expand Down Expand Up @@ -313,6 +325,7 @@ def test_sort_by_depth(self):
"whitelist": False,
"canonical": False,
"prefer_specific": False,
"count": 10,
},
["unknown genre"],
{
Expand Down Expand Up @@ -545,7 +558,9 @@ def test_sort_by_depth(self):
),
],
)
def test_get_genre(config_values, item_genre, mock_genres, expected_result):
def test_get_genre(
config, config_values, item_genre, mock_genres, expected_result
):
"""Test _get_genre with various configurations."""

def mock_fetch_track_genre(self, trackartist, tracktitle):
Expand Down
Loading