diff --git a/.travis.yml b/.travis.yml index 86c1c126dd..5c53cd8459 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,9 @@ sudo: false language: generic env: - - SW=$HOME/sw PATH=$SW/bin:$PATH CFLAGS=-I$SW/include LDFLAGS=-L$SW/lib LD_LIBRARY_PATH=$SW/qt/lib:$SW/lib PKG_CONFIG_PATH=$SW/lib/pkgconfig QMAKE=$SW/qt/bin/qmake QT_PLUGIN_PATH=$sw/qt/plugins + - SW=$HOME/sw PATH=$SW/bin:$PATH CFLAGS=-I$SW/include LDFLAGS=-L$SW/lib LD_LIBRARY_PATH=$SW/qt/lib:$SW/lib PKG_CONFIG_PATH=$SW/lib/pkgconfig QMAKE=$SW/qt/bin/qmake QT_PLUGIN_PATH=$SW/qt/plugins before_install: - curl https://download.calibre-ebook.com/travis/sw-linux.tar.xz | tar xJ -C $HOME - - python -c "from PyQt5.QtCore import QCoreApplication; print(QCoreApplication.libraryPaths())" - python setup.py bootstrap --ephemeral script: python setup.py test diff --git a/setup/test.py b/setup/test.py index fc021d95d7..e0a829939f 100644 --- a/setup/test.py +++ b/setup/test.py @@ -79,9 +79,6 @@ class Test(Command): def run(self, opts): from calibre.utils.run_tests import run_cli, filter_tests_by_name - if is_travis: - from calibre.gui2 import ensure_app - ensure_app() tests = find_tests(which_tests=frozenset(opts.test_module)) if opts.test_name: tests = filter_tests_by_name(tests, *opts.test_name) diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 5ec643a683..046b94d419 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -103,6 +103,13 @@ class BuildTest(unittest.TestCase): def test_qt(self): from PyQt5.Qt import QImageReader, QNetworkAccessManager, QFontDatabase from calibre.utils.img import image_from_data, image_to_data, test + # Ensure that images can be read before QApplication is constructed. + # Note that this requires QCoreApplication.libraryPaths() to return the + # path to the Qt plugins which it always does in the frozen build, + # because the QT_PLUGIN_PATH env var is set. On non-frozen builds, + # 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, 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)