mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
add a multithreaded import test case
This commit is contained in:
parent
89f33466e0
commit
c03ec1ee1c
1 changed files with 9 additions and 4 deletions
|
|
@ -71,7 +71,7 @@ class NonAutotaggedImportTest(unittest.TestCase):
|
||||||
|
|
||||||
return realpath
|
return realpath
|
||||||
|
|
||||||
def _run_import(self, titles=TEST_TITLES, delete=False):
|
def _run_import(self, titles=TEST_TITLES, delete=False, threaded=False):
|
||||||
# Make a bunch of tracks to import.
|
# Make a bunch of tracks to import.
|
||||||
paths = []
|
paths = []
|
||||||
for i, title in enumerate(titles):
|
for i, title in enumerate(titles):
|
||||||
|
|
@ -93,7 +93,7 @@ class NonAutotaggedImportTest(unittest.TestCase):
|
||||||
autot=False,
|
autot=False,
|
||||||
logfile=None,
|
logfile=None,
|
||||||
art=False,
|
art=False,
|
||||||
threaded=False,
|
threaded=threaded,
|
||||||
color=False,
|
color=False,
|
||||||
delete=delete,
|
delete=delete,
|
||||||
quiet=True,
|
quiet=True,
|
||||||
|
|
@ -111,8 +111,7 @@ class NonAutotaggedImportTest(unittest.TestCase):
|
||||||
self.assertEqual(len(albums), 1)
|
self.assertEqual(len(albums), 1)
|
||||||
self.assertEqual(albums[0].albumartist, 'The Artist')
|
self.assertEqual(albums[0].albumartist, 'The Artist')
|
||||||
|
|
||||||
def test_import_copy_arrives(self):
|
def _copy_arrives(self):
|
||||||
self._run_import()
|
|
||||||
artist_folder = os.path.join(self.libdir, 'The Artist')
|
artist_folder = os.path.join(self.libdir, 'The Artist')
|
||||||
album_folder = os.path.join(artist_folder, 'The Album')
|
album_folder = os.path.join(artist_folder, 'The Album')
|
||||||
self.assertEqual(len(os.listdir(artist_folder)), 1)
|
self.assertEqual(len(os.listdir(artist_folder)), 1)
|
||||||
|
|
@ -121,6 +120,12 @@ class NonAutotaggedImportTest(unittest.TestCase):
|
||||||
filenames = set(os.listdir(album_folder))
|
filenames = set(os.listdir(album_folder))
|
||||||
destinations = set('%s.mp3' % title for title in TEST_TITLES)
|
destinations = set('%s.mp3' % title for title in TEST_TITLES)
|
||||||
self.assertEqual(filenames, destinations)
|
self.assertEqual(filenames, destinations)
|
||||||
|
def test_import_copy_arrives(self):
|
||||||
|
self._run_import()
|
||||||
|
self._copy_arrives()
|
||||||
|
def test_threaded_import_copy_arrives(self):
|
||||||
|
self._run_import(threaded=True)
|
||||||
|
self._copy_arrives()
|
||||||
|
|
||||||
def test_import_no_delete(self):
|
def test_import_no_delete(self):
|
||||||
paths = self._run_import(['sometrack'], delete=False)
|
paths = self._run_import(['sometrack'], delete=False)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue