From 6d6509df577bdd9d0aaee7a276d100baa76099a1 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 25 Mar 2019 23:57:10 -0400 Subject: [PATCH] python3: make qt image test work on python3 QByteArrays are natively bytes and ended up looking like this: u"b'xpm'" Instead use the builtin method to get the data back, and decode it to unicode. --- src/calibre/test_build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 7ce4075714..17259fecd0 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -175,7 +175,7 @@ class BuildTest(unittest.TestCase): # it should just work because the hard-coded paths of the Qt # installation should work. If they do not, then it is a distro # problem. - fmts = set(map(unicode_type, QImageReader.supportedImageFormats())) + fmts = set(map(lambda x: x.data().decode('utf-8'), QImageReader.supportedImageFormats())) testf = {'jpg', 'png', 'svg', 'ico', 'gif'} self.assertEqual(testf.intersection(fmts), testf, "Qt doesn't seem to be able to load some of its image plugins. Available plugins: %s" % fmts) data = P('images/blank.png', allow_user_override=False, data=True)