diff --git a/setup/test.py b/setup/test.py index d1ec343f61..7f27623125 100644 --- a/setup/test.py +++ b/setup/test.py @@ -83,8 +83,6 @@ class Test(Command): ' can be run by specifying the name "something".') def run(self, opts): - from calibre.gui2 import ensure_app, load_builtin_fonts - ensure_app(), load_builtin_fonts() r = unittest.TextTestRunner tests = find_tests(which_tests=frozenset(opts.test_module)) if opts.test_name: diff --git a/src/calibre/srv/tests/content.py b/src/calibre/srv/tests/content.py index 2d14519da2..730a938b74 100644 --- a/src/calibre/srv/tests/content.py +++ b/src/calibre/srv/tests/content.py @@ -15,6 +15,11 @@ from calibre.srv.tests.base import LibraryBaseTest from calibre.utils.imghdr import identify from calibre.utils.shared_file import share_open, test as test_share_open +def setUpModule(): + # Needed for cover generation + from calibre.gui2 import ensure_app, load_builtin_fonts + ensure_app(), load_builtin_fonts() + class ContentTest(LibraryBaseTest): def test_static(self): # {{{ diff --git a/src/calibre/srv/tests/main.py b/src/calibre/srv/tests/main.py index 96c34a848a..59644ce589 100644 --- a/src/calibre/srv/tests/main.py +++ b/src/calibre/srv/tests/main.py @@ -63,8 +63,6 @@ def find_tests(): return unittest.TestSuite(suits) def run_tests(find_tests=find_tests): - from calibre.gui2 import ensure_app, load_builtin_fonts - ensure_app(), load_builtin_fonts() # needed for dynamic cover generation parser = argparse.ArgumentParser() parser.add_argument('name', nargs='?', default=None, help='The name of the test to run, for e.g. writing.WritingTest.many_many_basic or .many_many_basic for a shortcut')