mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Detect a generic CI server rather than just Travis
This commit is contained in:
parent
bdb2a763d2
commit
f0f73830b7
@ -12,7 +12,7 @@ from urllib import urlretrieve
|
|||||||
from zipfile import ZipFile, ZIP_STORED, ZipInfo
|
from zipfile import ZipFile, ZIP_STORED, ZipInfo
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
from tempfile import mkdtemp, SpooledTemporaryFile
|
from tempfile import mkdtemp, SpooledTemporaryFile
|
||||||
is_travis = os.environ.get('TRAVIS') == 'true'
|
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||||
|
|
||||||
|
|
||||||
from setup import Command
|
from setup import Command
|
||||||
@ -70,7 +70,7 @@ class MathJax(Command):
|
|||||||
zf.comment = self.h.hexdigest()
|
zf.comment = self.h.hexdigest()
|
||||||
t.seek(0)
|
t.seek(0)
|
||||||
with open(self.j(self.RESOURCES, 'content-server', 'mathjax.zip.xz'), 'wb') as f:
|
with open(self.j(self.RESOURCES, 'content-server', 'mathjax.zip.xz'), 'wb') as f:
|
||||||
compress(t, f, level=1 if is_travis else 9)
|
compress(t, f, level=1 if is_ci else 9)
|
||||||
with open(self.j(self.RESOURCES, 'content-server', 'mathjax.version'), 'wb') as f:
|
with open(self.j(self.RESOURCES, 'content-server', 'mathjax.version'), 'wb') as f:
|
||||||
f.write(zf.comment)
|
f.write(zf.comment)
|
||||||
finally:
|
finally:
|
||||||
|
@ -13,7 +13,7 @@ from functools import partial
|
|||||||
|
|
||||||
from setup import Command, __appname__, __version__, require_git_master, build_cache_dir
|
from setup import Command, __appname__, __version__, require_git_master, build_cache_dir
|
||||||
from setup.parallel_build import parallel_check_output
|
from setup.parallel_build import parallel_check_output
|
||||||
is_travis = os.environ.get('TRAVIS') == 'true'
|
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||||
|
|
||||||
def qt_sources():
|
def qt_sources():
|
||||||
qtdir = '/usr/src/qt5'
|
qtdir = '/usr/src/qt5'
|
||||||
@ -387,7 +387,7 @@ class Translations(POT): # {{{
|
|||||||
self.write_cache(cdata, current_hash, src)
|
self.write_cache(cdata, current_hash, src)
|
||||||
if raw:
|
if raw:
|
||||||
zi = ZipInfo(os.path.basename(src).rpartition('.')[0])
|
zi = ZipInfo(os.path.basename(src).rpartition('.')[0])
|
||||||
zi.compress_type = ZIP_STORED if is_travis else ZIP_DEFLATED
|
zi.compress_type = ZIP_STORED if is_ci else ZIP_DEFLATED
|
||||||
zf.writestr(zi, raw)
|
zf.writestr(zi, raw)
|
||||||
|
|
||||||
def check_iso639(self, raw, path):
|
def check_iso639(self, raw, path):
|
||||||
|
@ -14,7 +14,7 @@ from calibre import guess_type
|
|||||||
from calibre.srv.tests.base import BaseTest, TestServer
|
from calibre.srv.tests.base import BaseTest, TestServer
|
||||||
from calibre.utils.monotonic import monotonic
|
from calibre.utils.monotonic import monotonic
|
||||||
|
|
||||||
is_travis = os.environ.get('TRAVIS') == 'true'
|
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||||
|
|
||||||
class TestHTTP(BaseTest):
|
class TestHTTP(BaseTest):
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class TestHTTP(BaseTest):
|
|||||||
conn._HTTPConnection__state = httplib._CS_REQ_SENT
|
conn._HTTPConnection__state = httplib._CS_REQ_SENT
|
||||||
return conn.getresponse()
|
return conn.getresponse()
|
||||||
|
|
||||||
base_timeout = 0.5 if is_travis else 0.1
|
base_timeout = 0.5 if is_ci else 0.1
|
||||||
|
|
||||||
with TestServer(handler, timeout=base_timeout, max_header_line_size=100./1024, max_request_body_size=100./(1024*1024)) as server:
|
with TestServer(handler, timeout=base_timeout, max_header_line_size=100./1024, max_request_body_size=100./(1024*1024)) as server:
|
||||||
conn = server.connect()
|
conn = server.connect()
|
||||||
|
@ -21,7 +21,7 @@ from calibre.srv.pre_activated import has_preactivated_support
|
|||||||
from calibre.srv.tests.base import BaseTest, TestServer
|
from calibre.srv.tests.base import BaseTest, TestServer
|
||||||
from calibre.ptempfile import TemporaryDirectory
|
from calibre.ptempfile import TemporaryDirectory
|
||||||
from calibre.utils.monotonic import monotonic
|
from calibre.utils.monotonic import monotonic
|
||||||
is_travis = os.environ.get('TRAVIS') == 'true'
|
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||||
|
|
||||||
class LoopTest(BaseTest):
|
class LoopTest(BaseTest):
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class LoopTest(BaseTest):
|
|||||||
with TestServer(lambda data:(data.path[0] + data.read()), listen_on='1.1.1.1', fallback_to_detected_interface=True, specialize=specialize) as server:
|
with TestServer(lambda data:(data.path[0] + data.read()), listen_on='1.1.1.1', fallback_to_detected_interface=True, specialize=specialize) as server:
|
||||||
self.assertNotEqual('1.1.1.1', server.address[0])
|
self.assertNotEqual('1.1.1.1', server.address[0])
|
||||||
|
|
||||||
@skipIf(is_travis, 'Travis does not support BonJour')
|
@skipIf(is_ci, 'Continuous Integration servers do not support BonJour')
|
||||||
def test_bonjour(self):
|
def test_bonjour(self):
|
||||||
'Test advertising via BonJour'
|
'Test advertising via BonJour'
|
||||||
from calibre.srv.bonjour import BonJour
|
from calibre.srv.bonjour import BonJour
|
||||||
|
@ -14,11 +14,11 @@ Test a binary calibre build to ensure that all needed binary images/libraries ha
|
|||||||
|
|
||||||
import os, ctypes, sys, unittest
|
import os, ctypes, sys, unittest
|
||||||
from calibre.constants import plugins, iswindows, islinux, isosx
|
from calibre.constants import plugins, iswindows, islinux, isosx
|
||||||
is_travis = os.environ.get('TRAVIS') == 'true'
|
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||||
|
|
||||||
class BuildTest(unittest.TestCase):
|
class BuildTest(unittest.TestCase):
|
||||||
|
|
||||||
@unittest.skipUnless(iswindows, 'DLL loading needs testing only on windows')
|
@unittest.skipUnless(iswindows and not is_ci, 'DLL loading needs testing only on windows (non-continuous integration)')
|
||||||
def test_dlls(self):
|
def test_dlls(self):
|
||||||
import win32api
|
import win32api
|
||||||
base = win32api.GetDllDirectory()
|
base = win32api.GetDllDirectory()
|
||||||
@ -60,7 +60,7 @@ class BuildTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_plugins(self):
|
def test_plugins(self):
|
||||||
exclusions = set()
|
exclusions = set()
|
||||||
if is_travis:
|
if is_ci:
|
||||||
if isosx:
|
if isosx:
|
||||||
# The compiler version on OS X is different between the
|
# The compiler version on OS X is different between the
|
||||||
# machine on which the dependencies are built and the
|
# machine on which the dependencies are built and the
|
||||||
@ -206,7 +206,7 @@ class BuildTest(unittest.TestCase):
|
|||||||
import psutil
|
import psutil
|
||||||
psutil.Process(os.getpid())
|
psutil.Process(os.getpid())
|
||||||
|
|
||||||
@unittest.skipIf(is_travis and isosx, 'Currently there is a C++ ABI incompatibility until the osx-build machine is moved to OS X 10.9')
|
@unittest.skipIf(is_ci and isosx, 'Currently there is a C++ ABI incompatibility until the osx-build machine is moved to OS X 10.9')
|
||||||
def test_podofo(self):
|
def test_podofo(self):
|
||||||
from calibre.utils.podofo import test_podofo as dotest
|
from calibre.utils.podofo import test_podofo as dotest
|
||||||
dotest()
|
dotest()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user