CI: skip discogs tests when discogs_client missing, guard empty items, reset config in test

This commit is contained in:
Jack 2026-03-09 17:55:19 -04:00 committed by Šarūnas Nejus
parent 99eec9ec25
commit 04e5d0083d
2 changed files with 6 additions and 0 deletions

View file

@ -287,6 +287,9 @@ class DiscogsPlugin(SearchApiMetadataSourcePlugin[IDResponse]):
filters: dict[str, str] = {"type": "release"}
if not items:
return query, filters
for tag, api_field in self.extra_discogs_field_by_tag.items():
# The Discogs search API does not provide direct equivalents for
# MusicBrainz "alias" or "tracks" search fields, so we ignore

View file

@ -18,6 +18,8 @@ from unittest.mock import Mock, patch
import pytest
pytest.importorskip("discogs_client", reason="discogs optional dependency not installed")
from beets import config
from beets.library import Item
from beets.test._common import Bag
@ -500,6 +502,7 @@ class DGSearchQueryTest(BeetsTestCase):
assert filters["label"] == "abc"
# Catalog number should have whitespace removed.
assert filters["catno"] == "ABC123"
config["discogs"]["extra_tags"] = []
@pytest.mark.parametrize(