commit:     9d611ed29750cf1035eb1a77f5097c69bb0573d5
Author:     Petr Vaněk <arkamar <AT> atlas <DOT> cz>
AuthorDate: Wed Feb 22 15:16:44 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 22 15:59:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d611ed2

media-sound/beets: Fix tests

Few tests were failing because of changes in dependencies, namely in
dev-python/mediafile and dev-python/unidecode.

Closes: https://bugs.gentoo.org/876427
Closes: https://bugs.gentoo.org/895862
Signed-off-by: Petr Vaněk <arkamar <AT> atlas.cz>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-sound/beets/beets-1.6.0.ebuild               |  2 +
 media-sound/beets/files/1.6.0-mediafile-test.patch | 41 +++++++++++++++++++
 media-sound/beets/files/1.6.0-unicode-test.patch   | 47 ++++++++++++++++++++++
 3 files changed, 90 insertions(+)

diff --git a/media-sound/beets/beets-1.6.0.ebuild 
b/media-sound/beets/beets-1.6.0.ebuild
index 4fc0ecd49e53..d27548ed87e2 100644
--- a/media-sound/beets/beets-1.6.0.ebuild
+++ b/media-sound/beets/beets-1.6.0.ebuild
@@ -85,6 +85,8 @@ BDEPEND="
 PATCHES=(
        "${FILESDIR}/${PV}-0001-Remove-test_completion.patch"
        "${FILESDIR}/${PV}-sphinx-6.patch"
+       "${FILESDIR}/${PV}-mediafile-test.patch"
+       "${FILESDIR}/${PV}-unicode-test.patch"
 )
 
 DOCS=( README.rst docs/changelog.rst )

diff --git a/media-sound/beets/files/1.6.0-mediafile-test.patch 
b/media-sound/beets/files/1.6.0-mediafile-test.patch
new file mode 100644
index 000000000000..0feb8be7c98d
--- /dev/null
+++ b/media-sound/beets/files/1.6.0-mediafile-test.patch
@@ -0,0 +1,41 @@
+used to work due to inconsistent mediafile implementation, but with
+https://github.com/beetbox/mediafile/pull/64 (in mediafile >= 0.11.0)
+list fields are None if non-existent, not the empty list
+
+Upstream-PR: https://github.com/beetbox/beets/pull/4593
+
+diff --git a/test/test_embedart.py b/test/test_embedart.py
+index 6b6d616..bc550a8 100644
+--- a/test/test_embedart.py
++++ b/test/test_embedart.py
+@@ -81,7 +81,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
+         self.run_command('embedart', '-f', self.small_artpath)
+         mediafile = MediaFile(syspath(item.path))
+         # make sure that images array is empty (nothing embedded)
+-        self.assertEqual(len(mediafile.images), 0)
++        self.assertFalse(mediafile.images)
+ 
+     def test_embed_art_from_file(self):
+         self._setup_data()
+@@ -202,7 +202,7 @@ class EmbedartCliTest(_common.TestCase, TestHelper):
+         self.io.addinput('y')
+         self.run_command('clearart')
+         mediafile = MediaFile(syspath(item.path))
+-        self.assertEqual(len(mediafile.images), 0)
++        self.assertFalse(mediafile.images)
+ 
+     def test_clear_art_with_no_input(self):
+         self._setup_data()
+diff --git a/test/test_zero.py b/test/test_zero.py
+index c4c1769..b48367b 100644
+--- a/test/test_zero.py
++++ b/test/test_zero.py
+@@ -103,7 +103,7 @@ class ZeroPluginTest(unittest.TestCase, TestHelper):
+         item.write()
+ 
+         mf = MediaFile(syspath(path))
+-        self.assertEqual(0, len(mf.images))
++        self.assertFalse(mf.images)
+ 
+     def test_auto_false(self):
+         self.config['zero']['fields'] = ['year']

diff --git a/media-sound/beets/files/1.6.0-unicode-test.patch 
b/media-sound/beets/files/1.6.0-unicode-test.patch
new file mode 100644
index 000000000000..8b69e09557c9
--- /dev/null
+++ b/media-sound/beets/files/1.6.0-unicode-test.patch
@@ -0,0 +1,47 @@
+Unidecode 1.3.5 (a yanked PyPI version) changed the behavior of
+Unidecode for some specific characters:
+
+> Remove trailing space in replacements for vulgar fractions.
+
+As luck would have it, our tests used the 1/2 character specifically to
+test the behavior when these characters decoded to contain slashes. We
+now pin a sufficiently recent version of Unidecode and adapt the tests
+to match the new behavior.
+
+Upstream-Commit: 
https://github.com/beetbox/beets/commit/5ae1e0f3c8d3a450cb39f7933aa49bb78c2bc0d9
+
+diff --git a/setup.py b/setup.py
+index 264bb2e..69eb987 100755
+--- a/setup.py
++++ b/setup.py
+@@ -85,7 +85,7 @@ setup(
+     },
+ 
+     install_requires=[
+-        'unidecode',
++        'unidecode>=1.3.6',
+         'musicbrainzngs>=0.4',
+         'pyyaml',
+         'mediafile>=0.2.0',
+diff --git a/test/test_library.py b/test/test_library.py
+index 667d92c..b1cb579 100644
+--- a/test/test_library.py
++++ b/test/test_library.py
+@@ -441,7 +441,7 @@ class DestinationTest(_common.TestCase):
+         self.lib.directory = b'lib'
+         self.lib.path_formats = [('default', '$title')]
+         self.i.title = 'ab\xa2\xbdd'
+-        self.assertEqual(self.i.destination(), np('lib/abC_ 1_2 d'))
++        self.assertEqual(self.i.destination(), np('lib/abC_ 1_2d'))
+ 
+     def test_destination_with_replacements(self):
+         self.lib.directory = b'base'
+@@ -637,7 +637,7 @@ class DestinationFunctionTest(_common.TestCase, 
PathFormattingMixin):
+ 
+     def test_asciify_variable(self):
+         self._setf('%asciify{ab\xa2\xbdd}')
+-        self._assert_dest(b'/base/abC_ 1_2 d')
++        self._assert_dest(b'/base/abC_ 1_2d')
+ 
+     def test_left_variable(self):
+         self._setf('%left{$title, 3}')

Reply via email to