From 723b4bbfe98f7487235203fe97654a7d1bab5b63 Mon Sep 17 00:00:00 2001 From: Arne Beer Date: Tue, 3 Mar 2026 00:07:15 +0100 Subject: [PATCH] fix(lastgenre): Reset plugin config in fixtured tests --- test/plugins/test_lastgenre.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/plugins/test_lastgenre.py b/test/plugins/test_lastgenre.py index 55524d3fc..6646acbda 100644 --- a/test/plugins/test_lastgenre.py +++ b/test/plugins/test_lastgenre.py @@ -203,6 +203,16 @@ class LastGenrePluginTest(IOMixin, PluginTestCase): 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", [ @@ -232,6 +242,7 @@ class LastGenrePluginTest(IOMixin, PluginTestCase): "whitelist": True, "canonical": False, "prefer_specific": False, + "count": 10, }, ["original unknown", "Blues"], { @@ -264,6 +275,7 @@ class LastGenrePluginTest(IOMixin, PluginTestCase): "whitelist": True, "canonical": False, "prefer_specific": False, + "count": 10, }, ["original unknown", "Blues"], { @@ -313,6 +325,7 @@ class LastGenrePluginTest(IOMixin, PluginTestCase): "whitelist": False, "canonical": False, "prefer_specific": False, + "count": 10, }, ["unknown genre"], { @@ -545,7 +558,9 @@ class LastGenrePluginTest(IOMixin, PluginTestCase): ), ], ) -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):