From 191ce078e71d2ffd9672ee8021064934041215c0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Oct 2020 22:11:26 +0530 Subject: [PATCH] plugin_err must always be a string --- src/calibre/constants.py | 2 +- src/calibre/test_build.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 01dcf6a46f..c27511c635 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -316,7 +316,7 @@ class Plugins(collections.Mapping): def __getitem__(self, name): from importlib import import_module try: - return import_module('calibre_extensions.' + name), None + return import_module('calibre_extensions.' + name), '' except ModuleNotFoundError: raise KeyError('No plugin named %r'%name) except Exception as err: diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index df49f1ad59..de45f0cb66 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -114,7 +114,7 @@ class BuildTest(unittest.TestCase): ctypes.CDLL(os.path.join(plugins_loc, name + ('.dylib' if ismacos else '.so'))) continue mod, err = plugins[name] - self.assertFalse(err or not mod, 'Failed to load plugin: ' + name + ' with error:\n' + err) + self.assertTrue(mod, f'Failed to load plugin: {name} with error: {err}') def test_lxml(self): from calibre.utils.cleantext import test_clean_xml_chars