mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Reset cached_classproperty cache for every test
This commit is contained in:
parent
455d620ae0
commit
e6895bb52d
3 changed files with 6 additions and 4 deletions
|
|
@ -58,7 +58,6 @@ from beets.ui.commands import TerminalImportSession
|
||||||
from beets.util import (
|
from beets.util import (
|
||||||
MoveOperation,
|
MoveOperation,
|
||||||
bytestring_path,
|
bytestring_path,
|
||||||
cached_classproperty,
|
|
||||||
clean_module_tempdir,
|
clean_module_tempdir,
|
||||||
syspath,
|
syspath,
|
||||||
)
|
)
|
||||||
|
|
@ -495,7 +494,6 @@ class PluginMixin(ConfigMixin):
|
||||||
# FIXME this should eventually be handled by a plugin manager
|
# FIXME this should eventually be handled by a plugin manager
|
||||||
plugins = (self.plugin,) if hasattr(self, "plugin") else plugins
|
plugins = (self.plugin,) if hasattr(self, "plugin") else plugins
|
||||||
self.config["plugins"] = plugins
|
self.config["plugins"] = plugins
|
||||||
cached_classproperty.cache.clear()
|
|
||||||
beets.plugins.load_plugins()
|
beets.plugins.load_plugins()
|
||||||
|
|
||||||
def unload_plugins(self) -> None:
|
def unload_plugins(self) -> None:
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ class TestDistance:
|
||||||
config["match"]["distance_weights"]["album"] = 4.0
|
config["match"]["distance_weights"]["album"] = 4.0
|
||||||
config["match"]["distance_weights"]["medium"] = 2.0
|
config["match"]["distance_weights"]["medium"] = 2.0
|
||||||
|
|
||||||
Distance.__dict__["_weights"].cache = {}
|
|
||||||
|
|
||||||
return Distance()
|
return Distance()
|
||||||
|
|
||||||
def test_add(self, dist):
|
def test_add(self, dist):
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import os
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from beets.dbcore.query import Query
|
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):
|
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 inspect.getsource(val).split("lambda")[-1][:30]
|
||||||
|
|
||||||
return repr(val)
|
return repr(val)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def clear_cached_classproperty():
|
||||||
|
cached_classproperty.cache.clear()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue