Simplify embedart test changes for #2422

Whenever possible, it's nice to avoid using DummyIO---it can make debugging
difficult.
This commit is contained in:
Adrian Sampson 2017-03-06 23:55:14 -05:00
parent b91185a9ff
commit 5a71ce722a

View file

@ -52,8 +52,6 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
def setUp(self):
super(EmbedartCliTest, self).setUp()
self.io.install()
self.setup_beets() # Converter is threaded
self.load_plugins('embedart')
@ -71,8 +69,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
self._setup_data()
album = self.add_album_fixture()
item = album.items()[0]
self.io.addinput('y')
self.run_command('embedart', '-f', self.small_artpath)
self.run_command('embedart', '-y', '-f', self.small_artpath)
mediafile = MediaFile(syspath(item.path))
self.assertEqual(mediafile.images[0].data, self.image_data)
@ -82,8 +79,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
item = album.items()[0]
album.artpath = self.small_artpath
album.store()
self.io.addinput('y')
self.run_command('embedart')
self.run_command('embedart', '-y')
mediafile = MediaFile(syspath(item.path))
self.assertEqual(mediafile.images[0].data, self.image_data)
@ -101,8 +97,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
album.store()
config['embedart']['remove_art_file'] = True
self.io.addinput('y')
self.run_command('embedart')
self.run_command('embedart', '-y')
if os.path.isfile(tmp_path):
os.remove(tmp_path)
@ -112,8 +107,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
self.add_album_fixture()
logging.getLogger('beets.embedart').setLevel(logging.DEBUG)
with self.assertRaises(ui.UserError):
self.io.addinput('y')
self.run_command('embedart', '-f', '/doesnotexist')
self.run_command('embedart', '-y', '-f', '/doesnotexist')
def test_embed_non_image_file(self):
album = self.add_album_fixture()
@ -124,8 +118,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
os.close(handle)
try:
self.io.addinput('y')
self.run_command('embedart', '-f', tmp_path)
self.run_command('embedart', '-y', '-f', tmp_path)
finally:
os.remove(tmp_path)
@ -137,11 +130,9 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
self._setup_data(self.abbey_artpath)
album = self.add_album_fixture()
item = album.items()[0]
self.io.addinput('y')
self.run_command('embedart', '-f', self.abbey_artpath)
self.run_command('embedart', '-y', '-f', self.abbey_artpath)
config['embedart']['compare_threshold'] = 20
self.io.addinput('y')
self.run_command('embedart', '-f', self.abbey_differentpath)
self.run_command('embedart', '-y', '-f', self.abbey_differentpath)
mediafile = MediaFile(syspath(item.path))
self.assertEqual(mediafile.images[0].data, self.image_data,
@ -153,8 +144,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
self._setup_data(self.abbey_similarpath)
album = self.add_album_fixture()
item = album.items()[0]
self.io.addinput('y')
self.run_command('embedart', '-f', self.abbey_artpath)
self.run_command('embedart', '-y', '-f', self.abbey_artpath)
config['embedart']['compare_threshold'] = 20
self.run_command('embedart', '-y', '-f', self.abbey_similarpath)
mediafile = MediaFile(syspath(item.path))