Aaaah, now I get it :)

This commit is contained in:
Kovid Goyal 2016-06-24 23:13:10 +05:30
parent 9c1498d4ca
commit d11e8ce62c
3 changed files with 8 additions and 5 deletions

View File

@ -2,10 +2,9 @@ sudo: false
language: generic language: generic
env: 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: before_install:
- curl https://download.calibre-ebook.com/travis/sw-linux.tar.xz | tar xJ -C $HOME - 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 - python setup.py bootstrap --ephemeral
script: python setup.py test script: python setup.py test

View File

@ -79,9 +79,6 @@ class Test(Command):
def run(self, opts): def run(self, opts):
from calibre.utils.run_tests import run_cli, filter_tests_by_name 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)) tests = find_tests(which_tests=frozenset(opts.test_module))
if opts.test_name: if opts.test_name:
tests = filter_tests_by_name(tests, *opts.test_name) tests = filter_tests_by_name(tests, *opts.test_name)

View File

@ -103,6 +103,13 @@ class BuildTest(unittest.TestCase):
def test_qt(self): def test_qt(self):
from PyQt5.Qt import QImageReader, QNetworkAccessManager, QFontDatabase from PyQt5.Qt import QImageReader, QNetworkAccessManager, QFontDatabase
from calibre.utils.img import image_from_data, image_to_data, test 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())) fmts = set(map(unicode, QImageReader.supportedImageFormats()))
testf = {'jpg', 'png', 'svg', 'ico', 'gif'} 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) self.assertEqual(testf.intersection(fmts), testf, "Qt doesn't seem to be able to load some of its image plugins. Available plugins: %s" % fmts)