Fix build test failures on travis

This commit is contained in:
Kovid Goyal 2016-06-24 09:38:33 +05:30
parent 60814b0589
commit 6ffc59ead5
2 changed files with 19 additions and 16 deletions

View File

@ -6,12 +6,14 @@ env:
before_install:
- sudo add-apt-repository -y ppa:fkrull/deadsnakes-python2.7
- sudo apt-get -qq update
- sudo apt-get install -qq -y python-dev python-imaging python-mechanize python-lxml python-dateutil python-cssutils python-dnspython poppler-utils libpodofo-dev libwmf-dev libchm-dev libicu-dev libmtp-dev python-netifaces python-psutil python-apsw python-dbus python-pygments optipng qtbase5-private-dev libqt5webkit5-dev libqt5x11extras5-dev libqt5svg5-dev qt5-default libfontconfig1-dev libssl-dev libsqlite3-dev libudev-dev libxrender-dev
- sudo apt-get install -qq -y python-dev python-imaging python-mechanize python-lxml python-dateutil python-cssutils python-dnspython poppler-utils libpodofo-dev libwmf-dev libchm-dev libicu-dev libmtp-dev python-netifaces python-psutil python-apsw python-dbus python-pygments qtbase5-private-dev libqt5webkit5-dev libqt5x11extras5-dev libqt5svg5-dev qt5-default libfontconfig1-dev libssl-dev libsqlite3-dev libudev-dev libxrender-dev libjpeg-progs
- curl https://download.calibre-ebook.com/travis/sw.tar.xz | tar xJ -C $HOME
- python setup.py bootstrap --ephemeral
script: python setup.py test
# Commands used to build sip and PyQt5 (as trusty has no python 2 PyQt packages)
# Commands used to build optipng, sip and PyQt5 (as trusty has no python 2 PyQt packages)
# optipng:
# ./configure --prefix=/home/kovid/sw && make -j2 && make install
# Sip:
# python configure.py -b ~/sw/bin -d ~/sw/lib/python2.7/dist-packages -e ~/sw/include/python2.7 -v ~/sw/share/sip && make -j2 && make install
# PyQt (we cannot build the webkit module as Qt is too old):

View File

@ -14,6 +14,7 @@ Test a binary calibre build to ensure that all needed binary images/libraries ha
import os, ctypes, sys, unittest
from calibre.constants import plugins, iswindows, islinux, isosx
is_travis = os.environ.get('TRAVIS') == 'true'
class BuildTest(unittest.TestCase):
@ -31,6 +32,7 @@ class BuildTest(unittest.TestCase):
@unittest.skipUnless(islinux, 'DBUS only used on linux')
def test_dbus(self):
import dbus
if 'DISPLAY' in os.environ:
bus = dbus.SystemBus()
self.assertTrue(bus.list_names(), 'Failed to list names on the system bus')
bus = dbus.SessionBus()
@ -58,6 +60,8 @@ class BuildTest(unittest.TestCase):
def test_plugins(self):
for name in plugins:
if is_travis and name in ('libusb', 'libmtp'):
continue
mod, err = plugins[name]
self.assertFalse(err or not mod, 'Failed to load plugin: ' + name + ' with error:\n' + err)
@ -111,18 +115,19 @@ class BuildTest(unittest.TestCase):
test()
from calibre.gui2 import Application
from PyQt5.Qt import (QImageReader, QNetworkAccessManager, QFontDatabase)
from PyQt5.QtWebKitWidgets import QWebView
from PyQt5.Qt import QImageReader, QNetworkAccessManager, QFontDatabase
os.environ.pop('DISPLAY', None)
app = Application([], headless=islinux)
self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig')
fmts = set(map(unicode, QImageReader.supportedImageFormats()))
testf = set(['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 its image plugins")
QWebView()
del QWebView
na = QNetworkAccessManager()
self.assertTrue(hasattr(na, 'sslErrors'), 'Qt not compiled with openssl')
if not is_travis:
from PyQt5.QtWebKitWidgets import QWebView
QWebView()
del QWebView
del na
del app
@ -195,10 +200,6 @@ class BuildTest(unittest.TestCase):
from calibre.library.comments import sanitize_html
sanitize_html(b'''<script>moo</script>xxx<img src="http://moo.com/x.jpg">''')
def test_image_compression(self):
from calibre.utils.img import test
test()
def test_openssl(self):
import ssl
ssl.PROTOCOL_TLSv1_2