diff --git a/test/plugins/test_advancedrewrite.py b/test/plugins/test_advancedrewrite.py index 0d491f8a7..491e76127 100644 --- a/test/plugins/test_advancedrewrite.py +++ b/test/plugins/test_advancedrewrite.py @@ -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] = [ diff --git a/test/plugins/test_albumtypes.py b/test/plugins/test_albumtypes.py index 4a32db382..e436f5aae 100644 --- a/test/plugins/test_albumtypes.py +++ b/test/plugins/test_albumtypes.py @@ -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.""" diff --git a/test/plugins/test_bareasc.py b/test/plugins/test_bareasc.py index 02af15f8d..b3833df3d 100644 --- a/test/plugins/test_bareasc.py +++ b/test/plugins/test_bareasc.py @@ -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 = [ ( diff --git a/test/plugins/test_beatport.py b/test/plugins/test_beatport.py index 9b07ebb0d..98807e9c8 100644 --- a/test/plugins/test_beatport.py +++ b/test/plugins/test_beatport.py @@ -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 = [] diff --git a/test/plugins/test_bucket.py b/test/plugins/test_bucket.py index adae967b2..922062110 100644 --- a/test/plugins/test_bucket.py +++ b/test/plugins/test_bucket.py @@ -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=[], diff --git a/test/plugins/test_convert.py b/test/plugins/test_convert.py index 12b72bf85..9aa98f4c1 100644 --- a/test/plugins/test_convert.py +++ b/test/plugins/test_convert.py @@ -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") diff --git a/test/plugins/test_edit.py b/test/plugins/test_edit.py index 2e6ae0745..c9bd85466 100644 --- a/test/plugins/test_edit.py +++ b/test/plugins/test_edit.py @@ -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): diff --git a/test/plugins/test_embedart.py b/test/plugins/test_embedart.py index 4d78582b5..c696ae85d 100644 --- a/test/plugins/test_embedart.py +++ b/test/plugins/test_embedart.py @@ -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() diff --git a/test/plugins/test_embyupdate.py b/test/plugins/test_embyupdate.py index a2d527c21..d79c01a65 100644 --- a/test/plugins/test_embyupdate.py +++ b/test/plugins/test_embyupdate.py @@ -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): diff --git a/test/plugins/test_export.py b/test/plugins/test_export.py index 746293130..acf76d48b 100644 --- a/test/plugins/test_export.py +++ b/test/plugins/test_export.py @@ -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()) diff --git a/test/plugins/test_fetchart.py b/test/plugins/test_fetchart.py index 61075c792..ae1fcb96a 100644 --- a/test/plugins/test_fetchart.py +++ b/test/plugins/test_fetchart.py @@ -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) diff --git a/test/plugins/test_filefilter.py b/test/plugins/test_filefilter.py index a97fc5f32..f55aedbac 100644 --- a/test/plugins/test_filefilter.py +++ b/test/plugins/test_filefilter.py @@ -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") diff --git a/test/plugins/test_ftintitle.py b/test/plugins/test_ftintitle.py index 923bf14ef..32c8e0e02 100644 --- a/test/plugins/test_ftintitle.py +++ b/test/plugins/test_ftintitle.py @@ -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( diff --git a/test/plugins/test_hook.py b/test/plugins/test_hook.py index ee79b3599..ef26fd1a6 100644 --- a/test/plugins/test_hook.py +++ b/test/plugins/test_hook.py @@ -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} diff --git a/test/plugins/test_importadded.py b/test/plugins/test_importadded.py index baa9f880b..b41b91eee 100644 --- a/test/plugins/test_importadded.py +++ b/test/plugins/test_importadded.py @@ -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): diff --git a/test/plugins/test_info.py b/test/plugins/test_info.py index bb8f97cf0..4ab8aa70c 100644 --- a/test/plugins/test_info.py +++ b/test/plugins/test_info.py @@ -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() diff --git a/test/plugins/test_ipfs.py b/test/plugins/test_ipfs.py index dcea85288..cd23b65ad 100644 --- a/test/plugins/test_ipfs.py +++ b/test/plugins/test_ipfs.py @@ -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() diff --git a/test/plugins/test_keyfinder.py b/test/plugins/test_keyfinder.py index 329733b47..dfd35f61f 100644 --- a/test/plugins/test_keyfinder.py +++ b/test/plugins/test_keyfinder.py @@ -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): diff --git a/test/plugins/test_lastgenre.py b/test/plugins/test_lastgenre.py index bf36039df..249ecb5fd 100644 --- a/test/plugins/test_lastgenre.py +++ b/test/plugins/test_lastgenre.py @@ -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 ): diff --git a/test/plugins/test_limit.py b/test/plugins/test_limit.py index 1ea57894c..2c01dca76 100644 --- a/test/plugins/test_limit.py +++ b/test/plugins/test_limit.py @@ -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.""" diff --git a/test/plugins/test_mbsubmit.py b/test/plugins/test_mbsubmit.py index 83cfb1b92..f82f8c851 100644 --- a/test/plugins/test_mbsubmit.py +++ b/test/plugins/test_mbsubmit.py @@ -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): diff --git a/test/plugins/test_mbsync.py b/test/plugins/test_mbsync.py index cc6837c51..62c08f685 100644 --- a/test/plugins/test_mbsync.py +++ b/test/plugins/test_mbsync.py @@ -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") diff --git a/test/plugins/test_mpdstats.py b/test/plugins/test_mpdstats.py index 1dc9b3a6e..e60a32f4f 100644 --- a/test/plugins/test_mpdstats.py +++ b/test/plugins/test_mpdstats.py @@ -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): diff --git a/test/plugins/test_parentwork.py b/test/plugins/test_parentwork.py index 372c1ed2f..fedcc6ceb 100644 --- a/test/plugins/test_parentwork.py +++ b/test/plugins/test_parentwork.py @@ -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): diff --git a/test/plugins/test_permissions.py b/test/plugins/test_permissions.py index 82fb3c443..14ac77cfc 100644 --- a/test/plugins/test_permissions.py +++ b/test/plugins/test_permissions.py @@ -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): diff --git a/test/plugins/test_play.py b/test/plugins/test_play.py index 8dcf9d044..563cb7f3a 100644 --- a/test/plugins/test_play.py +++ b/test/plugins/test_play.py @@ -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( diff --git a/test/plugins/test_player.py b/test/plugins/test_player.py index 486808d33..b7735ff10 100644 --- a/test/plugins/test_player.py +++ b/test/plugins/test_player.py @@ -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 diff --git a/test/plugins/test_playlist.py b/test/plugins/test_playlist.py index 63018ef68..c7a2caa96 100644 --- a/test/plugins/test_playlist.py +++ b/test/plugins/test_playlist.py @@ -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: diff --git a/test/plugins/test_plexupdate.py b/test/plugins/test_plexupdate.py index e8e7b83b4..ba4890dbe 100644 --- a/test/plugins/test_plexupdate.py +++ b/test/plugins/test_plexupdate.py @@ -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 diff --git a/test/plugins/test_smartplaylist.py b/test/plugins/test_smartplaylist.py index 9655f3f90..f2aa5e1ab 100644 --- a/test/plugins/test_smartplaylist.py +++ b/test/plugins/test_smartplaylist.py @@ -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): diff --git a/test/plugins/test_spotify.py b/test/plugins/test_spotify.py index c2fcc0722..2a385195b 100644 --- a/test/plugins/test_spotify.py +++ b/test/plugins/test_spotify.py @@ -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)) diff --git a/test/plugins/test_subsonicupdate.py b/test/plugins/test_subsonicupdate.py index be7f979ac..9cfcef47e 100644 --- a/test/plugins/test_subsonicupdate.py +++ b/test/plugins/test_subsonicupdate.py @@ -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.""" diff --git a/test/plugins/test_thumbnails.py b/test/plugins/test_thumbnails.py index 942b91db0..c2c22bed2 100644 --- a/test/plugins/test_thumbnails.py +++ b/test/plugins/test_thumbnails.py @@ -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") diff --git a/test/plugins/test_types_plugin.py b/test/plugins/test_types_plugin.py index 54766e7aa..2f00ec425 100644 --- a/test/plugins/test_types_plugin.py +++ b/test/plugins/test_types_plugin.py @@ -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"} diff --git a/test/plugins/test_zero.py b/test/plugins/test_zero.py index 1925bd464..8be71b686 100644 --- a/test/plugins/test_zero.py +++ b/test/plugins/test_zero.py @@ -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): diff --git a/test/test_art_resize.py b/test/test_art_resize.py index e7bee02dc..f5ec88f32 100644 --- a/test/test_art_resize.py +++ b/test/test_art_resize.py @@ -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 diff --git a/test/test_config_command.py b/test/test_config_command.py index 72a0affd9..4383f6664 100644 --- a/test/test_config_command.py +++ b/test/test_config_command.py @@ -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) diff --git a/test/test_importer.py b/test/test_importer.py index 95e8fd933..f510b81ac 100644 --- a/test/test_importer.py +++ b/test/test_importer.py @@ -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 diff --git a/test/test_library.py b/test/test_library.py index d224f055c..bce4dbb66 100644 --- a/test/test_library.py +++ b/test/test_library.py @@ -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) diff --git a/test/test_logging.py b/test/test_logging.py index 0cd3d4821..ad5346186 100644 --- a/test/test_logging.py +++ b/test/test_logging.py @@ -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) diff --git a/test/test_metasync.py b/test/test_metasync.py index a3bc3acb2..f320d4a5e 100644 --- a/test/test_metasync.py +++ b/test/test_metasync.py @@ -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 diff --git a/test/test_plugins.py b/test/test_plugins.py index 2ea24b02c..bda12c2d2 100644 --- a/test/test_plugins.py +++ b/test/test_plugins.py @@ -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): diff --git a/test/test_ui.py b/test/test_ui.py index 8b3ef7276..890a033f8 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -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) diff --git a/test/test_ui_init.py b/test/test_ui_init.py index 9febd397c..813ef2dca 100644 --- a/test/test_ui_init.py +++ b/test/test_ui_init.py @@ -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"),