mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
tests: properly install & restore some fixtures
Brought up while investigating #612.
This commit is contained in:
parent
5eb7b4204b
commit
03fa8d809b
1 changed files with 30 additions and 8 deletions
|
|
@ -49,7 +49,7 @@ class AutotagStub(object):
|
|||
|
||||
return self
|
||||
|
||||
def restore():
|
||||
def restore(self):
|
||||
autotag.mb.match_album = self.mb_match_album
|
||||
autotag.mb.match_track = self.mb_match_album
|
||||
|
||||
|
|
@ -327,7 +327,6 @@ class ImportSingletonTest(_common.TestCase, ImportHelper):
|
|||
"""Test ``APPLY`` and ``ASIS`` choices for an import session with singletons
|
||||
config set to True.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(ImportSingletonTest, self).setUp()
|
||||
self._setup_library()
|
||||
|
|
@ -336,6 +335,10 @@ class ImportSingletonTest(_common.TestCase, ImportHelper):
|
|||
config['import']['singletons'] = True
|
||||
self.matcher = AutotagStub().install()
|
||||
|
||||
def tearDown(self):
|
||||
super(ImportSingletonTest, self).tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_apply_asis_adds_track(self):
|
||||
self.assertEqual(self.lib.items().get(), None)
|
||||
|
||||
|
|
@ -391,7 +394,6 @@ class ImportSingletonTest(_common.TestCase, ImportHelper):
|
|||
class ImportTest(_common.TestCase, ImportHelper):
|
||||
"""Test APPLY, ASIS and SKIP choices.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(ImportTest, self).setUp()
|
||||
self._setup_library()
|
||||
|
|
@ -400,6 +402,10 @@ class ImportTest(_common.TestCase, ImportHelper):
|
|||
self.matcher = AutotagStub().install()
|
||||
self.matcher.macthin = AutotagStub.GOOD
|
||||
|
||||
def tearDown(self):
|
||||
super(ImportTest, self).tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_apply_asis_adds_album(self):
|
||||
self.assertEqual(self.lib.albums().get(), None)
|
||||
|
||||
|
|
@ -472,7 +478,6 @@ class ImportTest(_common.TestCase, ImportHelper):
|
|||
class ImportTracksTest(_common.TestCase, ImportHelper):
|
||||
"""Test TRACKS and APPLY choice.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(ImportTracksTest, self).setUp()
|
||||
self._setup_library()
|
||||
|
|
@ -480,6 +485,10 @@ class ImportTracksTest(_common.TestCase, ImportHelper):
|
|||
self._setup_import_session()
|
||||
self.matcher = AutotagStub().install()
|
||||
|
||||
def tearDown(self):
|
||||
super(ImportTracksTest, self).tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_apply_tracks_adds_singleton_track(self):
|
||||
self.assertEqual(self.lib.items().get(), None)
|
||||
self.assertEqual(self.lib.albums().get(), None)
|
||||
|
|
@ -503,12 +512,16 @@ class ImportTracksTest(_common.TestCase, ImportHelper):
|
|||
class ImportCompilationTest(_common.TestCase, ImportHelper):
|
||||
"""Test ASIS import of a folder containing tracks with different artists.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(ImportCompilationTest, self).setUp()
|
||||
self._setup_library()
|
||||
self._create_import_dir(3)
|
||||
self._setup_import_session()
|
||||
self.matcher = AutotagStub().install()
|
||||
|
||||
def tearDown(self):
|
||||
super(ImportCompilationTest, self).tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_asis_homogenous_sets_albumartist(self):
|
||||
self.importer.add_choice(importer.action.ASIS)
|
||||
|
|
@ -573,7 +586,6 @@ class ImportCompilationTest(_common.TestCase, ImportHelper):
|
|||
class ImportExistingTest(_common.TestCase, ImportHelper):
|
||||
"""Test importing files that are already in the library directory.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(ImportExistingTest, self).setUp()
|
||||
self._setup_library()
|
||||
|
|
@ -586,6 +598,10 @@ class ImportExistingTest(_common.TestCase, ImportHelper):
|
|||
|
||||
self._setup_import_session(import_dir=self.libdir)
|
||||
|
||||
def tearDown(self):
|
||||
super(ImportExistingTest, self).tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_does_not_duplicate_item(self):
|
||||
self.setup_importer.run()
|
||||
self.assertEqual(len((self.lib.items())), 1)
|
||||
|
|
@ -681,7 +697,6 @@ class ImportExistingTest(_common.TestCase, ImportHelper):
|
|||
self.assertNotExists(self.import_media[0].path)
|
||||
|
||||
class GroupAlbumsImportTest(_common.TestCase, ImportHelper):
|
||||
|
||||
def setUp(self):
|
||||
super(GroupAlbumsImportTest, self).setUp()
|
||||
self._setup_library()
|
||||
|
|
@ -695,6 +710,10 @@ class GroupAlbumsImportTest(_common.TestCase, ImportHelper):
|
|||
self.importer.add_choice(importer.action.ASIS)
|
||||
self.importer.add_choice(importer.action.ASIS)
|
||||
|
||||
def tearDown(self):
|
||||
super(GroupAlbumsImportTest, self).tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_add_album_for_different_artist_and_different_album(self):
|
||||
self.import_media[0].artist = "Artist B"
|
||||
self.import_media[0].album = "Album B"
|
||||
|
|
@ -750,7 +769,6 @@ class GlobalGroupAlbumsImportTest(GroupAlbumsImportTest):
|
|||
config['import']['group_albums'] = True
|
||||
|
||||
class ChooseCandidateTest(_common.TestCase, ImportHelper):
|
||||
|
||||
def setUp(self):
|
||||
super(ChooseCandidateTest, self).setUp()
|
||||
self._setup_library()
|
||||
|
|
@ -759,6 +777,10 @@ class ChooseCandidateTest(_common.TestCase, ImportHelper):
|
|||
self.matcher = AutotagStub().install()
|
||||
self.matcher.matching = AutotagStub.BAD
|
||||
|
||||
def tearDown(self):
|
||||
super(ChooseCandidateTest, self).tearDown()
|
||||
self.matcher.restore()
|
||||
|
||||
def test_choose_first_candidate(self):
|
||||
self.importer.add_choice(1)
|
||||
self.importer.run()
|
||||
|
|
|
|||
Loading…
Reference in a new issue