Skip to content

Commit 7afe965

Browse files
committed
fix(lastgenre): Reset plugin config in fixtured tests
1 parent 31bbd1f commit 7afe965

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/plugins/test_lastgenre.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,16 @@ def test_sort_by_depth(self):
203203
assert res == ["ambient", "electronic"]
204204

205205

206+
@pytest.fixture
207+
def config(config):
208+
"""Provide a fresh beets configuration for every test/parameterize call
209+
210+
This is necessary to prevent the following parameterized test to bleed
211+
config test state in between test cases.
212+
."""
213+
return config
214+
215+
206216
@pytest.mark.parametrize(
207217
"config_values, item_genre, mock_genres, expected_result",
208218
[
@@ -232,6 +242,7 @@ def test_sort_by_depth(self):
232242
"whitelist": True,
233243
"canonical": False,
234244
"prefer_specific": False,
245+
"count": 10,
235246
},
236247
["original unknown", "Blues"],
237248
{
@@ -264,6 +275,7 @@ def test_sort_by_depth(self):
264275
"whitelist": True,
265276
"canonical": False,
266277
"prefer_specific": False,
278+
"count": 10,
267279
},
268280
["original unknown", "Blues"],
269281
{
@@ -313,6 +325,7 @@ def test_sort_by_depth(self):
313325
"whitelist": False,
314326
"canonical": False,
315327
"prefer_specific": False,
328+
"count": 10,
316329
},
317330
["unknown genre"],
318331
{
@@ -545,7 +558,9 @@ def test_sort_by_depth(self):
545558
),
546559
],
547560
)
548-
def test_get_genre(config_values, item_genre, mock_genres, expected_result):
561+
def test_get_genre(
562+
config, config_values, item_genre, mock_genres, expected_result
563+
):
549564
"""Test _get_genre with various configurations."""
550565

551566
def mock_fetch_track_genre(self, trackartist, tracktitle):

0 commit comments

Comments
 (0)