From 83fcbf7e1786221d9a4266ac8473dadaa03953bd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 19 Dec 2021 10:42:28 +0530 Subject: [PATCH] Delay load hunspell --- src/calibre/spell/dictionary.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/calibre/spell/dictionary.py b/src/calibre/spell/dictionary.py index 3825f6dd9d..3aae5a9d81 100644 --- a/src/calibre/spell/dictionary.py +++ b/src/calibre/spell/dictionary.py @@ -7,7 +7,6 @@ import os import re import shutil import sys -from calibre_extensions import hunspell from collections import defaultdict, namedtuple from functools import partial from itertools import chain @@ -164,6 +163,7 @@ def get_dictionary(locale, exact_match=False): def load_dictionary(dictionary): + from calibre_extensions import hunspell def fix_path(path): if isinstance(path, bytes): @@ -456,3 +456,12 @@ def find_tests(): self.assertIn('List', self.suggestions('Lis𝑘t')) return unittest.TestLoader().loadTestsFromTestCase(TestDictionaries) + + +def test(): + from calibre.utils.run_tests import run_cli + run_cli(find_tests()) + + +if __name__ == '__main__': + test()