plugin_err must always be a string

This commit is contained in:
Kovid Goyal 2020-10-15 22:11:26 +05:30
parent fe40196c06
commit 191ce078e7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 2 deletions

View File

@ -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:

View File

@ -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