Reset cached_classproperty cache for every test

This commit is contained in:
Šarūnas Nejus 2025-10-06 09:00:46 +01:00
parent 455d620ae0
commit e6895bb52d
No known key found for this signature in database
3 changed files with 6 additions and 4 deletions

View file

@ -58,7 +58,6 @@ from beets.ui.commands import TerminalImportSession
from beets.util import (
MoveOperation,
bytestring_path,
cached_classproperty,
clean_module_tempdir,
syspath,
)
@ -495,7 +494,6 @@ class PluginMixin(ConfigMixin):
# FIXME this should eventually be handled by a plugin manager
plugins = (self.plugin,) if hasattr(self, "plugin") else plugins
self.config["plugins"] = plugins
cached_classproperty.cache.clear()
beets.plugins.load_plugins()
def unload_plugins(self) -> None:

View file

@ -27,8 +27,6 @@ class TestDistance:
config["match"]["distance_weights"]["album"] = 4.0
config["match"]["distance_weights"]["medium"] = 2.0
Distance.__dict__["_weights"].cache = {}
return Distance()
def test_add(self, dist):

View file

@ -4,6 +4,7 @@ import os
import pytest
from beets.dbcore.query import Query
from beets.util import cached_classproperty
def skip_marked_items(items: list[pytest.Item], marker_name: str, reason: str):
@ -41,3 +42,8 @@ def pytest_make_parametrize_id(config, val, argname):
return inspect.getsource(val).split("lambda")[-1][:30]
return repr(val)
@pytest.fixture(autouse=True)
def clear_cached_classproperty():
cached_classproperty.cache.clear()