mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Remove redundant setup_beets and teardown_beets instructions
This commit is contained in:
parent
b64eaeda0a
commit
2d5fd907c3
44 changed files with 102 additions and 211 deletions
|
|
@ -24,12 +24,9 @@ PLUGIN_NAME = "advancedrewrite"
|
|||
|
||||
|
||||
class AdvancedRewritePluginTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_simple_rewrite_example(self):
|
||||
self.config[PLUGIN_NAME] = [
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ class AlbumTypesPluginTest(BeetsTestCase):
|
|||
|
||||
def setUp(self):
|
||||
"""Set up tests."""
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("albumtypes")
|
||||
|
||||
def tearDown(self):
|
||||
"""Tear down tests."""
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_renames_types(self):
|
||||
"""Tests if the plugin correctly renames the specified types."""
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class BareascPluginTest(BeetsTestCase):
|
|||
|
||||
def setUp(self):
|
||||
"""Set up test environment for bare ASCII query matching."""
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.log = logging.getLogger("beets.web")
|
||||
self.config["bareasc"]["prefix"] = "#"
|
||||
self.load_plugins("bareasc")
|
||||
|
|
@ -27,9 +27,6 @@ class BareascPluginTest(BeetsTestCase):
|
|||
self.add_item(title="without umlaut or e", artist="Bruggen")
|
||||
self.add_item(title="without umlaut with e", artist="Brueggen")
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_bareasc_search(self):
|
||||
test_cases = [
|
||||
(
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ class BeatportTest(BeetsTestCase):
|
|||
return results
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("beatport")
|
||||
self.lib = library.Library(":memory:")
|
||||
|
||||
|
|
@ -470,7 +470,7 @@ class BeatportTest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def mk_test_album(self):
|
||||
items = [_common.item() for _ in range(6)]
|
||||
|
|
@ -628,7 +628,7 @@ class BeatportResponseEmptyTest(BeetsTestCase):
|
|||
return results
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("beatport")
|
||||
self.lib = library.Library(":memory:")
|
||||
|
||||
|
|
@ -641,7 +641,7 @@ class BeatportResponseEmptyTest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_response_tracks_empty(self):
|
||||
response_tracks = []
|
||||
|
|
|
|||
|
|
@ -24,12 +24,9 @@ from beetsplug import bucket
|
|||
|
||||
class BucketPluginTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.plugin = bucket.BucketPlugin()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def _setup_config(
|
||||
self,
|
||||
bucket_year=[],
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class ImportConvertTest(ConvertTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_import_converted(self):
|
||||
self.importer.run()
|
||||
|
|
@ -193,7 +193,7 @@ class ConvertCliTest(ConvertTestCase, ConvertCommand):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_convert(self):
|
||||
with control_stdin("y"):
|
||||
|
|
@ -334,7 +334,7 @@ class NeverConvertLossyFilesTest(ConvertTestCase, ConvertCommand):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_transcode_from_lossless(self):
|
||||
[item] = self.add_item_fixtures(ext="flac")
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class EditCommandTest(BeetsTestCase, EditMixin):
|
|||
TRACK_COUNT = 10
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("edit")
|
||||
# Add an album, storing the original fields for comparison.
|
||||
self.album = self.add_album_fixture(track_count=self.TRACK_COUNT)
|
||||
|
|
@ -136,7 +136,7 @@ class EditCommandTest(BeetsTestCase, EditMixin):
|
|||
|
||||
def tearDown(self):
|
||||
EditPlugin.listeners = None
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
def assertCounts( # noqa
|
||||
|
|
@ -330,7 +330,7 @@ class EditDuringImporterTestCase(
|
|||
IGNORED = ["added", "album_id", "id", "mtime", "path"]
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("edit")
|
||||
# Create some mediafiles, and store them for comparison.
|
||||
self._create_import_dir(3)
|
||||
|
|
@ -342,7 +342,7 @@ class EditDuringImporterTestCase(
|
|||
def tearDown(self):
|
||||
EditPlugin.listeners = None
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_edit_apply_asis(self):
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ class EmbedartCliTest(FetchImageHelper, BeetsTestCase):
|
|||
abbey_differentpath = os.path.join(_common.RSRC, b"abbey-different.jpg")
|
||||
|
||||
def setUp(self):
|
||||
super().setUp() # Converter is threaded
|
||||
self.io.install()
|
||||
self.setup_beets() # Converter is threaded
|
||||
self.load_plugins("embedart")
|
||||
|
||||
def _setup_data(self, artpath=None):
|
||||
|
|
@ -59,7 +59,7 @@ class EmbedartCliTest(FetchImageHelper, BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_embed_art_from_file_with_yes_input(self):
|
||||
self._setup_data()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from beetsplug import embyupdate
|
|||
|
||||
class EmbyUpdateTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("embyupdate")
|
||||
|
||||
self.config["emby"] = {
|
||||
|
|
@ -19,7 +19,7 @@ class EmbyUpdateTest(BeetsTestCase):
|
|||
}
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
def test_api_url_only_name(self):
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ from beets.test.helper import BeetsTestCase
|
|||
|
||||
class ExportPluginTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("export")
|
||||
self.test_values = {"title": "xtitle", "album": "xalbum"}
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def execute_command(self, format_type, artist):
|
||||
query = ",".join(self.test_values.keys())
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from beets.test.helper import BeetsTestCase
|
|||
|
||||
class FetchartCliTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("fetchart")
|
||||
self.config["fetchart"]["cover_names"] = "c\xc3\xb6ver.jpg"
|
||||
self.config["art_filename"] = "mycover"
|
||||
|
|
@ -33,7 +33,7 @@ class FetchartCliTest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def check_cover_is_stored(self):
|
||||
self.assertEqual(self.album["artpath"], self.cover_path)
|
||||
|
|
|
|||
|
|
@ -31,14 +31,11 @@ from beetsplug.filefilter import FileFilterPlugin
|
|||
|
||||
class FileFilterPluginTest(ImportTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.__create_import_dir(2)
|
||||
self._setup_import_session()
|
||||
config["import"]["pretend"] = True
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def __copy_file(self, dest_path, metadata):
|
||||
# Copy files
|
||||
resource_path = os.path.join(_common.RSRC, b"full.mp3")
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ from beetsplug import ftintitle
|
|||
class FtInTitlePluginFunctional(BeetsTestCase):
|
||||
def setUp(self):
|
||||
"""Set up configuration"""
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("ftintitle")
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def _ft_add_item(self, path, artist, title, aartist):
|
||||
return self.add_item(
|
||||
|
|
|
|||
|
|
@ -32,12 +32,9 @@ def get_temporary_path():
|
|||
class HookTest(BeetsTestCase):
|
||||
TEST_HOOK_COUNT = 5
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def _add_hook(self, event, command):
|
||||
hook = {"event": event, "command": command}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ImportAddedTest(ImportTestCase):
|
|||
|
||||
def setUp(self):
|
||||
preserve_plugin_listeners()
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("importadded")
|
||||
self._create_import_dir(2)
|
||||
# Different mtimes on the files to be imported in order to test the
|
||||
|
|
@ -62,7 +62,7 @@ class ImportAddedTest(ImportTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def find_media_file(self, item):
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ from beets.util import displayable_path
|
|||
|
||||
class InfoTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("info")
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_path(self):
|
||||
path = self.create_mediafile_fixture()
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ from beetsplug.ipfs import IPFSPlugin
|
|||
@patch("beets.util.command_output", Mock())
|
||||
class IPFSPluginTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("ipfs")
|
||||
self.lib = library.Library(":memory:")
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_stored_hashes(self):
|
||||
test_album = self.mk_test_album()
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ from beets.test.helper import BeetsTestCase
|
|||
@patch("beets.util.command_output")
|
||||
class KeyFinderTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("keyfinder")
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
def test_add_key(self, command_output):
|
||||
|
|
|
|||
|
|
@ -26,12 +26,9 @@ from beetsplug import lastgenre
|
|||
|
||||
class LastGenrePluginTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.plugin = lastgenre.LastGenrePlugin()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def _setup_config(
|
||||
self, whitelist=False, canonical=False, count=1, prefer_specific=False
|
||||
):
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class LimitPluginTest(BeetsTestCase):
|
|||
"""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("limit")
|
||||
|
||||
# we'll create an even number of tracks in the library
|
||||
|
|
@ -48,7 +48,7 @@ class LimitPluginTest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_no_limit(self):
|
||||
"""Returns all when there is no limit or filter."""
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ from beets.test.helper import (
|
|||
|
||||
class MBSubmitPluginTest(TerminalImportMixin, ImportTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("mbsubmit")
|
||||
self._create_import_dir(2)
|
||||
self._setup_import_session()
|
||||
|
|
@ -34,7 +34,7 @@ class MBSubmitPluginTest(TerminalImportMixin, ImportTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_print_tracks_output(self):
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ from beets.test.helper import (
|
|||
|
||||
class MbsyncCliTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("mbsync")
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
@patch("beets.autotag.mb.album_for_id")
|
||||
@patch("beets.autotag.mb.track_for_id")
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ from beetsplug.mpdstats import MPDStats
|
|||
|
||||
class MPDStatsTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("mpdstats")
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
def test_update_rating(self):
|
||||
|
|
|
|||
|
|
@ -88,12 +88,12 @@ def mock_workid_response(mbid, includes):
|
|||
class ParentWorkIntegrationTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
"""Set up configuration"""
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("parentwork")
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
# test how it works with real musicbrainz data
|
||||
@unittest.skipUnless(
|
||||
|
|
@ -183,7 +183,7 @@ class ParentWorkIntegrationTest(BeetsTestCase):
|
|||
class ParentWorkTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
"""Set up configuration"""
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("parentwork")
|
||||
self.patcher = patch(
|
||||
"musicbrainzngs.get_work_by_id", side_effect=mock_workid_response
|
||||
|
|
@ -192,7 +192,7 @@ class ParentWorkTest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.patcher.stop()
|
||||
|
||||
def test_normal_case(self):
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ from beetsplug.permissions import (
|
|||
|
||||
class PermissionsPluginTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("permissions")
|
||||
|
||||
self.config["permissions"] = {"file": "777", "dir": "777"}
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
def test_permissions_on_album_imported(self):
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ class PlayPluginTest(CleanupModulesMixin, BeetsTestCase):
|
|||
modules = (PlayPlugin.__module__,)
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("play")
|
||||
self.item = self.add_item(album="a nice älbum", title="aNiceTitle")
|
||||
self.lib.add_album([self.item])
|
||||
self.config["play"]["command"] = "echo"
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
def run_and_assert(
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ class BPDTestHelper(BeetsTestCase):
|
|||
self.lib.add_album([self.item1, self.item2])
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
@contextmanager
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from beets.test.helper import BeetsTestCase
|
|||
|
||||
class PlaylistTestCase(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.lib = beets.library.Library(":memory:")
|
||||
|
||||
self.music_dir = os.path.expanduser(os.path.join("~", "Music"))
|
||||
|
|
@ -86,7 +86,7 @@ class PlaylistTestCase(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
|
||||
class PlaylistQueryTest:
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ class PlexUpdateTest(BeetsTestCase):
|
|||
)
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("plexupdate")
|
||||
|
||||
self.config["plex"] = {"host": "localhost", "port": 32400}
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
@responses.activate
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ class SmartPlaylistTest(BeetsTestCase):
|
|||
|
||||
class SmartPlaylistCLITest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
|
||||
self.item = self.add_item()
|
||||
config["smartplaylist"]["playlists"].set(
|
||||
|
|
@ -354,7 +354,7 @@ class SmartPlaylistCLITest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_splupdate(self):
|
||||
with self.assertRaises(UserError):
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ from urllib.parse import parse_qs, urlparse
|
|||
|
||||
import responses
|
||||
|
||||
from beets import config
|
||||
from beets.library import Item
|
||||
from beets.test import _common
|
||||
from beets.test.helper import BeetsTestCase
|
||||
|
|
@ -28,8 +27,7 @@ def _params(url):
|
|||
class SpotifyPluginTest(BeetsTestCase):
|
||||
@responses.activate
|
||||
def setUp(self):
|
||||
config.clear()
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
responses.add(
|
||||
responses.POST,
|
||||
spotify.SpotifyPlugin.oauth_token_url,
|
||||
|
|
@ -46,9 +44,6 @@ class SpotifyPluginTest(BeetsTestCase):
|
|||
opts = ArgumentsMock("list", False)
|
||||
self.spotify._parse_opts(opts)
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_args(self):
|
||||
opts = ArgumentsMock("fail", True)
|
||||
self.assertFalse(self.spotify._parse_opts(opts))
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ class SubsonicPluginTest(BeetsTestCase):
|
|||
@responses.activate
|
||||
def setUp(self):
|
||||
"""Sets up config and plugin for test."""
|
||||
config.clear()
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
|
||||
config["subsonic"]["user"] = "admin"
|
||||
config["subsonic"]["pass"] = "admin"
|
||||
|
|
@ -89,10 +88,6 @@ class SubsonicPluginTest(BeetsTestCase):
|
|||
}
|
||||
"""
|
||||
|
||||
def tearDown(self):
|
||||
"""Tears down tests."""
|
||||
self.teardown_beets()
|
||||
|
||||
@responses.activate
|
||||
def test_start_scan(self):
|
||||
"""Tests success path based on best case scenario."""
|
||||
|
|
|
|||
|
|
@ -31,12 +31,6 @@ from beetsplug.thumbnails import (
|
|||
|
||||
|
||||
class ThumbnailsTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
@patch("beetsplug.thumbnails.ArtResizer")
|
||||
@patch("beetsplug.thumbnails.ThumbnailsPlugin._check_local_ok")
|
||||
@patch("beetsplug.thumbnails.os.stat")
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ from beets.test.helper import BeetsTestCase
|
|||
|
||||
class TypesPluginTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("types")
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_integer_modify_and_query(self):
|
||||
self.config["types"] = {"myint": "int"}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from beetsplug.zero import ZeroPlugin
|
|||
|
||||
class ZeroPluginTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.config["zero"] = {
|
||||
"fields": [],
|
||||
"keep_fields": [],
|
||||
|
|
@ -21,7 +21,7 @@ class ZeroPluginTest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
ZeroPlugin.listeners = None
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.unload_plugins()
|
||||
|
||||
def test_no_patterns(self):
|
||||
|
|
|
|||
|
|
@ -56,14 +56,6 @@ class ArtResizerFileSizeTest(CleanupModulesMixin, BeetsTestCase):
|
|||
IMG_225x225 = os.path.join(_common.RSRC, b"abbey.jpg")
|
||||
IMG_225x225_SIZE = os.stat(syspath(IMG_225x225)).st_size
|
||||
|
||||
def setUp(self):
|
||||
"""Called before each test, setting up beets."""
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
"""Called after each test, unloading all plugins."""
|
||||
self.teardown_beets()
|
||||
|
||||
def _test_img_resize(self, backend):
|
||||
"""Test resizing based on file size, given a resize_func."""
|
||||
# Check quality setting unaffected by new parameter
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from beets.test.helper import BeetsTestCase
|
|||
|
||||
class ConfigCommandTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
for k in ("VISUAL", "EDITOR"):
|
||||
if k in os.environ:
|
||||
del os.environ[k]
|
||||
|
|
@ -31,9 +31,6 @@ class ConfigCommandTest(BeetsTestCase):
|
|||
config["password"].redact = True
|
||||
config._materialized = False
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def _run_with_yaml_output(self, *args):
|
||||
output = self.run_with_output(*args)
|
||||
return yaml.safe_load(output)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class ScrubbedImportTest(ImportTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_tags_not_scrubbed(self):
|
||||
config["plugins"] = ["scrub"]
|
||||
|
|
@ -105,9 +105,6 @@ class NonAutotaggedImportTest(ImportTestCase):
|
|||
self._create_import_dir(2)
|
||||
self._setup_import_session(autotag=False)
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_album_created_with_track_artist(self):
|
||||
self.importer.run()
|
||||
albums = self.lib.albums()
|
||||
|
|
@ -277,14 +274,11 @@ class RmTempTest(ImportTestCase):
|
|||
"""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.want_resume = False
|
||||
self.config["incremental"] = False
|
||||
self._old_home = None
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_rm(self):
|
||||
zip_path = create_archive(self)
|
||||
archive_task = importer.ArchiveImportTask(zip_path)
|
||||
|
|
@ -297,12 +291,6 @@ class RmTempTest(ImportTestCase):
|
|||
|
||||
|
||||
class ImportZipTest(ImportTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_import_zip(self):
|
||||
zip_path = create_archive(self)
|
||||
self.assertEqual(len(self.lib.items()), 0)
|
||||
|
|
@ -350,14 +338,14 @@ class ImportSingletonTest(ImportTestCase):
|
|||
"""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self._create_import_dir(1)
|
||||
self._setup_import_session()
|
||||
config["import"]["singletons"] = True
|
||||
self.matcher = AutotagStub().install()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_apply_asis_adds_track(self):
|
||||
|
|
@ -471,14 +459,14 @@ class ImportTest(ImportTestCase):
|
|||
"""Test APPLY, ASIS and SKIP choices."""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self._create_import_dir(1)
|
||||
self._setup_import_session()
|
||||
self.matcher = AutotagStub().install()
|
||||
self.matcher.macthin = AutotagStub.GOOD
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_apply_asis_adds_album(self):
|
||||
|
|
@ -685,13 +673,13 @@ class ImportTracksTest(ImportTestCase):
|
|||
"""Test TRACKS and APPLY choice."""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self._create_import_dir(1)
|
||||
self._setup_import_session()
|
||||
self.matcher = AutotagStub().install()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_apply_tracks_adds_singleton_track(self):
|
||||
|
|
@ -719,13 +707,13 @@ class ImportCompilationTest(ImportTestCase):
|
|||
"""Test ASIS import of a folder containing tracks with different artists."""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self._create_import_dir(3)
|
||||
self._setup_import_session()
|
||||
self.matcher = AutotagStub().install()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_asis_homogenous_sets_albumartist(self):
|
||||
|
|
@ -838,7 +826,7 @@ class ImportExistingTest(ImportTestCase):
|
|||
"""Test importing files that are already in the library directory."""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self._create_import_dir(1)
|
||||
self.matcher = AutotagStub().install()
|
||||
|
||||
|
|
@ -849,7 +837,7 @@ class ImportExistingTest(ImportTestCase):
|
|||
self._setup_import_session(import_dir=self.libdir)
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_does_not_duplicate_item(self):
|
||||
|
|
@ -961,7 +949,7 @@ class ImportExistingTest(ImportTestCase):
|
|||
|
||||
class GroupAlbumsImportTest(ImportTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self._create_import_dir(3)
|
||||
self.matcher = AutotagStub().install()
|
||||
self.matcher.matching = AutotagStub.NONE
|
||||
|
|
@ -973,7 +961,7 @@ class GroupAlbumsImportTest(ImportTestCase):
|
|||
self.importer.add_choice(importer.action.ASIS)
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_add_album_for_different_artist_and_different_album(self):
|
||||
|
|
@ -1033,14 +1021,14 @@ class GlobalGroupAlbumsImportTest(GroupAlbumsImportTest):
|
|||
|
||||
class ChooseCandidateTest(ImportTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self._create_import_dir(1)
|
||||
self._setup_import_session()
|
||||
self.matcher = AutotagStub().install()
|
||||
self.matcher.matching = AutotagStub.BAD
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_choose_first_candidate(self):
|
||||
|
|
@ -1172,7 +1160,7 @@ def match_album_mock(*args, **kwargs):
|
|||
@patch("beets.autotag.mb.match_album", Mock(side_effect=match_album_mock))
|
||||
class ImportDuplicateAlbumTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
|
||||
# Original album
|
||||
self.add_album_fixture(albumartist="artist", album="album")
|
||||
|
|
@ -1182,9 +1170,6 @@ class ImportDuplicateAlbumTest(BeetsTestCase):
|
|||
config["import"]["autotag"] = True
|
||||
config["import"]["duplicate_keys"]["album"] = "albumartist album"
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_remove_duplicate_album(self):
|
||||
item = self.lib.items().get()
|
||||
self.assertEqual(item.title, "t\xeftle 0")
|
||||
|
|
@ -1294,7 +1279,7 @@ def match_track_mock(*args, **kwargs):
|
|||
@patch("beets.autotag.mb.match_track", Mock(side_effect=match_track_mock))
|
||||
class ImportDuplicateSingletonTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
|
||||
# Original file in library
|
||||
self.add_item_fixture(
|
||||
|
|
@ -1307,9 +1292,6 @@ class ImportDuplicateSingletonTest(BeetsTestCase):
|
|||
config["import"]["singletons"] = True
|
||||
config["import"]["duplicate_keys"]["item"] = "artist title"
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_remove_duplicate(self):
|
||||
item = self.lib.items().get()
|
||||
self.assertEqual(item.mb_trackid, "old trackid")
|
||||
|
|
@ -1382,12 +1364,6 @@ class TagLogTest(BeetsTestCase):
|
|||
|
||||
|
||||
class ResumeImportTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
@patch("beets.plugins.send")
|
||||
def test_resume_album(self, plugins_send):
|
||||
self.importer = self.create_importer(album_count=2)
|
||||
|
|
@ -1434,12 +1410,9 @@ class ResumeImportTest(BeetsTestCase):
|
|||
|
||||
class IncrementalImportTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.config["import"]["incremental"] = True
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_incremental_album(self):
|
||||
importer = self.create_importer(album_count=1)
|
||||
importer.run()
|
||||
|
|
@ -1656,7 +1629,7 @@ class ReimportTest(ImportTestCase):
|
|||
"""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
|
||||
# The existing album.
|
||||
album = self.add_album_fixture()
|
||||
|
|
@ -1674,7 +1647,7 @@ class ReimportTest(ImportTestCase):
|
|||
self.matcher.matching = AutotagStub.GOOD
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def _setup_session(self, singletons=False):
|
||||
|
|
@ -1759,8 +1732,7 @@ class ImportPretendTest(ImportTestCase):
|
|||
self.matcher = None
|
||||
|
||||
def setUp(self):
|
||||
self.io = _common.DummyIO()
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.__create_import_dir()
|
||||
self.__create_empty_import_dir()
|
||||
self._setup_import_session()
|
||||
|
|
@ -1769,7 +1741,7 @@ class ImportPretendTest(ImportTestCase):
|
|||
self.io.install()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def __create_import_dir(self):
|
||||
|
|
@ -1955,12 +1927,9 @@ class ImportMusicBrainzIdTest(ImportTestCase):
|
|||
ID_RECORDING_1 = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self._create_import_dir(1)
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_one_mbid_one_album(self):
|
||||
self.config["import"]["search_ids"] = [
|
||||
self.MB_RELEASE_PREFIX + self.ID_RELEASE_0
|
||||
|
|
|
|||
|
|
@ -1268,12 +1268,6 @@ class UnicodePathTest(ItemInDBTestCase):
|
|||
|
||||
|
||||
class WriteTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_write_nonexistant(self):
|
||||
item = self.create_item()
|
||||
item.path = b"/path/does/not/exist"
|
||||
|
|
@ -1356,12 +1350,6 @@ class ItemReadTest(unittest.TestCase):
|
|||
|
||||
|
||||
class FilesizeTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_filesize(self):
|
||||
item = self.add_item_fixture()
|
||||
self.assertNotEqual(item.filesize, 0)
|
||||
|
|
|
|||
|
|
@ -74,12 +74,12 @@ class LoggingLevelTest(BeetsTestCase):
|
|||
def setUp(self):
|
||||
sys.modules["beetsplug.dummy"] = self.DummyModule
|
||||
beetsplug.dummy = self.DummyModule
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("dummy")
|
||||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
del beetsplug.dummy
|
||||
sys.modules.pop("beetsplug.dummy")
|
||||
self.DummyModule.DummyPlugin.listeners = None
|
||||
|
|
@ -207,9 +207,6 @@ class ConcurrentEventsTest(BeetsTestCase):
|
|||
def setUp(self):
|
||||
self.setup_beets(disk=True)
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_concurrent_events(self):
|
||||
dp = self.DummyPlugin(self)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class MetaSyncTest(BeetsTestCase):
|
|||
)
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.load_plugins("metasync")
|
||||
|
||||
self.config["metasync"]["source"] = "itunes"
|
||||
|
|
@ -85,7 +85,7 @@ class MetaSyncTest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_load_item_types(self):
|
||||
# This test also verifies that the MetaSources have loaded correctly
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class PluginLoaderTestCase(BeetsTestCase):
|
|||
plugins._classes.update(self._plugin_classes)
|
||||
|
||||
load_plugins.side_effect = myload
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
|
||||
def teardown_plugin_loader(self):
|
||||
self._plugin_loader_patch.stop()
|
||||
|
|
@ -72,7 +72,7 @@ class PluginLoaderTestCase(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.teardown_plugin_loader()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
|
||||
class PluginImportTestCase(ImportHelper, PluginLoaderTestCase):
|
||||
|
|
|
|||
|
|
@ -191,13 +191,10 @@ class RemoveTest(BeetsTestCase):
|
|||
|
||||
class ModifyTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.album = self.add_album_fixture()
|
||||
[self.item] = self.album.items()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def modify_inp(self, inp, *args):
|
||||
with control_stdin(inp):
|
||||
self.run_command("modify", *args)
|
||||
|
|
@ -404,12 +401,6 @@ class ModifyTest(BeetsTestCase):
|
|||
|
||||
|
||||
class WriteTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def write_cmd(self, *args):
|
||||
return self.run_with_output("write", *args)
|
||||
|
||||
|
|
@ -846,7 +837,7 @@ class ImportTest(BeetsTestCase):
|
|||
@_common.slow_test()
|
||||
class ConfigTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
|
||||
# Don't use the BEETSDIR from `helper`. Instead, we point the home
|
||||
# directory there. Some tests will set `BEETSDIR` themselves.
|
||||
|
|
@ -895,7 +886,7 @@ class ConfigTest(BeetsTestCase):
|
|||
else:
|
||||
os.environ["APPDATA"] = self._old_appdata
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def _make_test_cmd(self):
|
||||
test_cmd = ui.Subcommand("test", help="test")
|
||||
|
|
@ -1474,7 +1465,7 @@ class CommonOptionsParserCliTest(BeetsTestCase):
|
|||
"""
|
||||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
super().setUp()
|
||||
self.item = _common.item()
|
||||
self.item.path = b"xxx/yyy"
|
||||
self.lib.add(self.item)
|
||||
|
|
@ -1483,7 +1474,7 @@ class CommonOptionsParserCliTest(BeetsTestCase):
|
|||
|
||||
def tearDown(self):
|
||||
self.unload_plugins()
|
||||
self.teardown_beets()
|
||||
super().tearDown()
|
||||
|
||||
def test_base(self):
|
||||
l = self.run_with_output("ls")
|
||||
|
|
@ -1552,12 +1543,6 @@ class CommonOptionsParserCliTest(BeetsTestCase):
|
|||
|
||||
|
||||
class CommonOptionsParserTest(BeetsTestCase):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
||||
def tearDown(self):
|
||||
self.teardown_beets()
|
||||
|
||||
def test_album_option(self):
|
||||
parser = ui.CommonOptionsParser()
|
||||
self.assertFalse(parser._album_flags)
|
||||
|
|
|
|||
|
|
@ -91,9 +91,6 @@ class InputMethodsTest(BeetsTestCase):
|
|||
|
||||
|
||||
class InitTest(ItemInDBTestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
def test_human_bytes(self):
|
||||
tests = [
|
||||
(0, "0.0 B"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue