From 36c2241a34dfba867a4f2196ed61ee7f6a90aac0 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 19 May 2015 16:09:39 -0700 Subject: [PATCH] Use bytestring filenames in embedart tests First step on #1461. --- test/_common.py | 4 ++-- test/test_embedart.py | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/_common.py b/test/_common.py index 350b4e948..4588dbb41 100644 --- a/test/_common.py +++ b/test/_common.py @@ -169,11 +169,11 @@ class TestCase(unittest.TestCase): def assertExists(self, path): self.assertTrue(os.path.exists(path), - 'file does not exist: %s' % path) + 'file does not exist: {!r}'.format(path)) def assertNotExists(self, path): self.assertFalse(os.path.exists(path), - 'file exists: %s' % path) + 'file exists: {!r}'.format((path))) class LibTestCase(TestCase): diff --git a/test/test_embedart.py b/test/test_embedart.py index 20de29500..055899a5f 100644 --- a/test/test_embedart.py +++ b/test/test_embedart.py @@ -133,16 +133,15 @@ class EmbedartCliTest(_common.TestCase, TestHelper): self.abbey_similarpath)) def test_non_ascii_album_path(self): - resource_path = os.path.join(_common.RSRC, 'image.mp3') + resource_path = os.path.join(_common.RSRC, 'image.mp3').encode('utf8') album = self.add_album_fixture() trackpath = album.items()[0].path albumpath = album.path - shutil.copy(resource_path, trackpath.decode('utf-8')) + shutil.copy(syspath(resource_path), syspath(trackpath)) self.run_command('extractart', '-n', 'extracted') - self.assertExists(os.path.join(albumpath.decode('utf-8'), - 'extracted.png')) + self.assertExists(syspath(os.path.join(albumpath, b'extracted.png'))) @patch('beets.art.subprocess')