diff --git a/test/test_convert.py b/test/test_convert.py index d3a1206be..1f1b1a7fb 100644 --- a/test/test_convert.py +++ b/test/test_convert.py @@ -44,26 +44,35 @@ class TestHelper(helper.TestHelper): def assertFileTag(self, path, tag): # noqa """Assert that the path is a file and the files content ends with `tag`. """ + display_tag = tag tag = tag.encode('utf-8') self.assertTrue(os.path.isfile(path), - u'{0} is not a file'.format(path)) + u'{0} is not a file'.format( + util.displayable_path(path))) with open(path, 'rb') as f: - f.seek(-len(tag), os.SEEK_END) + f.seek(-len(display_tag), os.SEEK_END) self.assertEqual(f.read(), tag, - u'{0} is not tagged with {1}'.format(path, tag)) + u'{0} is not tagged with {1}' + .format( + util.displayable_path(path), + display_tag)) def assertNoFileTag(self, path, tag): # noqa """Assert that the path is a file and the files content does not end with `tag`. """ + display_tag = tag tag = tag.encode('utf-8') self.assertTrue(os.path.isfile(path), - u'{0} is not a file'.format(path)) + u'{0} is not a file'.format( + util.displayable_path(path))) with open(path, 'rb') as f: f.seek(-len(tag), os.SEEK_END) self.assertNotEqual(f.read(), tag, u'{0} is unexpectedly tagged with {1}' - .format(path, tag)) + .format( + util.displayable_path(path), + display_tag)) @_common.slow_test() diff --git a/test/test_embedart.py b/test/test_embedart.py index 2f47e8f25..4ba5c3424 100644 --- a/test/test_embedart.py +++ b/test/test_embedart.py @@ -26,7 +26,7 @@ from test.helper import TestHelper from beets.mediafile import MediaFile from beets import config, logging, ui -from beets.util import syspath +from beets.util import syspath, displayable_path from beets.util.artresizer import ArtResizer from beets import art @@ -136,7 +136,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper): self.assertEqual(mediafile.images[0].data, self.image_data, u'Image written is not {0}'.format( - self.abbey_artpath)) + displayable_path(self.abbey_artpath))) @require_artresizer_compare def test_accept_similar_art(self): @@ -150,7 +150,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper): self.assertEqual(mediafile.images[0].data, self.image_data, u'Image written is not {0}'.format( - self.abbey_similarpath)) + displayable_path(self.abbey_similarpath))) def test_non_ascii_album_path(self): resource_path = os.path.join(_common.RSRC, b'image.mp3') diff --git a/test/test_permissions.py b/test/test_permissions.py index 7234ec30d..040839110 100644 --- a/test/test_permissions.py +++ b/test/test_permissions.py @@ -10,6 +10,7 @@ from mock import patch, Mock from test._common import unittest from test.helper import TestHelper +from beets.util import displayable_path from beetsplug.permissions import (check_permissions, convert_perm, dirs_in_library) @@ -67,9 +68,13 @@ class PermissionsPluginTest(unittest.TestCase, TestHelper): def assertPerms(self, path, typ, expect_success): # noqa for x in [(True, self.exp_perms[expect_success][typ], '!='), (False, self.exp_perms[not expect_success][typ], '==')]: - self.assertEqual(x[0], check_permissions(path, x[1]), - msg=u'{} : {} {} {}'.format( - path, oct(os.stat(path).st_mode), x[2], oct(x[1]))) + msg = u'{} : {} {} {}'.format( + displayable_path(path), + oct(os.stat(path).st_mode), + x[2], + oct(x[1]) + ) + self.assertEqual(x[0], check_permissions(path, x[1]), msg=msg) def test_convert_perm_from_string(self): self.assertEqual(convert_perm('10'), 8)