Commit c28fcf4b authored by Denis Bilenko's avatar Denis Bilenko

new travis build

- do pep8 and pyflakes checks
- do not tests examples with dependencies (psycopg2_pool.py, web.py, geventsendfile.py)
- do check -dbg build
- install cython from ppa
- drop 2.5, add 3.3 (currently fails)

new make commands:
 - make whitespace
 - make pep8
 - make pyflakes
 - make lint       # runs all of the above
 - make travis     # runs on travis

The linters are run first to abort broken builds early.

Removed --full option to testrunner.py, it is no longer needed.
parent b7bc2706
[pep8]
ignore=E702
max_line_length=160
exclude=.git,build,2.6,2.7,3.3,test_support.py,test_queue.py,patched_tests_setup.py,test_threading_2.py,lock_tests.py
language: python
python:
- "2.7"
env:
- EXTRA=1
- PYTHONVER=2.6
- PYTHONVER=2.7
- PYTHONVER=3.3
matrix:
include:
- python: 2.6
- python: 2.7
env: DEBUGPY=-dbg GEVENTSETUP_EV_VERIFY=3
- python: 2.6
env: DEBUGPY=-dbg GEVENTSETUP_EV_VERIFY=3
- python: 2.7
env: DEBUGPY=-dbg GEVENTSETUP_EV_VERIFY=3 GEVENT_FILE=thread
install:
- pip install --use-mirrors cython
- cython --version
- pip install --use-mirrors greenlet psycopg2 pysendfile web.py
- if [ "x$TRAVIS_PYTHON_VERSION" == "x2.7" ]; then pip install --use-mirrors -q pep8; fi
- python -c 'import greenlet; print greenlet, greenlet.__version__; import psycopg2; print psycopg2, psycopg2.__version__; import web; print web, web.__version__'
- export CYTHON=`which cython`
- python setup.py install
script:
- cd greentest && python testrunner.py --full --expected ../known_failures.txt
allow_failures:
- env: PYTHONVER=3.3
script: sudo -E make travis
notifications:
email:
recipients:
......
# This file is renamed to "Makefile.ext" in release tarballs so that setup.py won't try to
# run it. If you want setup.py to run "make" automatically, rename it back to "Makefile".
PYTHON ?= python
PYTHON ?= python${PYTHONVER}
CYTHON ?= cython
all: gevent/gevent.core.c gevent/gevent.ares.c gevent/gevent._semaphore.c gevent/gevent._util.c
......@@ -33,5 +33,55 @@ clean:
doc:
cd doc && PYTHONPATH=.. make html
whitespace:
! find . -not -path "./.git/*" -not -path "./build/*" -not -path "./libev/*" -not -path "./c-ares/*" -not -path "./doc/_build/*" -type f | xargs egrep -l " $$"
.PHONY: clean all doc
pep8:
pep8 .
pyflakes:
util/pyflakes.py
lint: whitespace pep8 pyflakes
travistest:
which ${PYTHON}
${PYTHON} --version
cd greenlet-* && ${PYTHON} setup.py install -q
${PYTHON} -c 'import greenlet; print (greenlet, greenlet.__version__)'
${PYTHON} setup.py install
cd greentest && GEVENT_RESOLVER=thread ${PYTHON} testrunner.py --expected ../known_failures.txt
cd greentest && GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 ${PYTHON} testrunner.py --expected ../known_failures.txt --ignore tests_that_dont_use_resolver.txt
# --ignore option does not work as expected XXX
cd greentest && GEVENT_FILE=thread ${PYTHON} testrunner.py --expected ../known_failures.txt --ignore tests_that_dont_use_subprocess.txt
travis:
make whitespace
pip install -q pep8
make pep8
pip install -q pyflakes
make pyflakes
sudo add-apt-repository -y ppa:chris-lea/cython
sudo apt-get -qq -y update
sudo apt-get -qq -y install cython
cython --version
pip install -q --download . greenlet
unzip -q greenlet-*.zip
ack -w subprocess greentest/ -l -v | python -c 'import sys; print "\n".join(line.split("/")[-1].strip() for line in sys.stdin)' > greentest/tests_that_dont_use_subprocess.txt
make travistest
apt-get install ${PYTHON}-dbg
PYTHON=${PYTHON}-dbg GEVENTSETUP_EV_VERIFY=3 make travistest
.PHONY: clean all doc pep8 whitespace pyflakes lint travistest travis
import sys
import time
#import time
from unittest import main
if sys.version_info[0] == 3:
from urllib import request as urllib2
......@@ -50,22 +50,22 @@ class Test_webproxy(Test_wsgiserver):
assert 'google' in data.lower(), repr(data)
class Test_webpy(Test_wsgiserver):
server = 'webpy.py'
not_found_message = 'not found'
def _test_hello(self):
status, data = self.read('/')
self.assertEqual(status, '200 OK')
assert "Hello, world" in data, repr(data)
def _test_long(self):
start = time.time()
status, data = self.read('/long')
delay = time.time() - start
assert 10 - 0.5 < delay < 10 + 0.5, delay
self.assertEqual(status, '200 OK')
self.assertEqual(data, 'Hello, 10 seconds later')
# class Test_webpy(Test_wsgiserver):
# server = 'webpy.py'
# not_found_message = 'not found'
#
# def _test_hello(self):
# status, data = self.read('/')
# self.assertEqual(status, '200 OK')
# assert "Hello, world" in data, repr(data)
#
# def _test_long(self):
# start = time.time()
# status, data = self.read('/long')
# delay = time.time() - start
# assert 10 - 0.5 < delay < 10 + 0.5, delay
# self.assertEqual(status, '200 OK')
# self.assertEqual(data, 'Hello, 10 seconds later')
if __name__ == '__main__':
......
......@@ -6,15 +6,19 @@ import util
cwd = '../examples/'
ignore = ['wsgiserver.py', 'wsgiserver_ssl.py', 'webproxy.py', 'webpy.py', 'unixsocket_server.py', 'unixsocket_client.py']
if sys.platform == 'win32':
ignore += ['geventsendfile.py', 'psycopg2_pool.py']
ignore = ['wsgiserver.py',
'wsgiserver_ssl.py',
'webproxy.py',
'webpy.py',
'unixsocket_server.py',
'unixsocket_client.py',
'psycopg2_pool.py',
'geventsendfile.py']
ignore += [x[14:] for x in glob.glob('test__example_*.py')]
default_time_range = (2, 4)
time_ranges = {
'concurrent_download.py': (0, 30),
'geventsendfile.py': (0, 4),
'processes.py': (0, 4)}
......
......@@ -124,24 +124,6 @@ def load_list_from_file(filename):
return result
def full(args=None):
tests = []
for setenv, ignore in [('GEVENT_RESOLVER=thread', None),
('GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8', 'tests_that_dont_use_resolver.txt')]:
setenv = dict(x.split('=') for x in setenv.split())
for cmd, options in discover(args, ignore=ignore):
my_setenv = options.get('setenv', {})
my_setenv.update(setenv)
options['setenv'] = my_setenv
tests.append((cmd, options))
if sys.version_info[:2] == (2, 7) and os.environ.get('EXTRA'):
tests.append(([sys.executable, '-u', 'xtest_pep8.py'], None))
return tests
def main():
import optparse
parser = optparse.OptionParser()
......@@ -152,11 +134,7 @@ def main():
parser.add_option('--failfast', action='store_true')
options, args = parser.parse_args()
options.expected = load_list_from_file(options.expected)
if options.full:
assert options.ignore is None, '--ignore and --full are not compatible'
tests = full(args)
else:
tests = discover(args, options.ignore)
tests = discover(args, options.ignore)
if options.discover:
for cmd, options in tests:
print (util.getname(cmd, env=options.get('env'), setenv=options.get('setenv')))
......
import sys
import os
sys.stderr.write('pep8 --version: ')
if os.system('pep8 --version'):
sys.exit('ERROR: pep8 script not found')
if not os.path.exists('gevent') and not os.path.exists('setup.py'):
os.chdir('..')
commands = [
'pep8 --show-source --max-line-length=160 gevent/ setup.py',
'pep8 --show-source --max-line-length=160 --ignore E702 examples/*.py',
'pep8 --show-source --max-line-length=160 --ignore E702,E128 examples/webchat',
'pep8 --show-source --max-line-length=160 doc/',
"pep8 --max-line-length=200 --exclude 'test_support.py,test_queue.py,lock_tests.py,patched_tests_setup.py,test_threading_2.py' --ignore E702 greentest/*.py",
'pep8 --show-source --max-line-length=160 --ignore E203,E128,E124,E201 greentest/patched_tests_setup.py']
failures = 0
for command in commands:
sys.stderr.write('+ %s\n' % command)
if os.system(command):
failures += 1
sys.exit(failures)
#!/usr/bin/python
import sys
import re
import subprocess
IGNORED = r'''
gevent/socket.py:\d+: undefined name
gevent/subprocess.py:\d+: undefined name
gevent/ssl.py:\d+: undefined name
gevent/__init__.py:\d+:.*imported but unused
gevent/__init__.py:\d+: redefinition of unused 'signal' from line
gevent/coros.py:\d+: 'from gevent.lock import *' used; unable to detect undefined names
gevent/coros.py:\d+: '__all__' imported but unused
gevent/subprocess.py:\d+: redefinition of unused 'rawlink' from line 311
gevent/thread.py:\d+: '_local' imported but unused
gevent/threading.py:\d+: '\w+' imported but unused
gevent/wsgi.py:1: 'from gevent.pywsgi import *' used; unable to detect undefined names
examples/webchat/urls.py:1: 'from django.conf.urls.defaults import *' used; unable to detect undefined names
greentest/test__queue.py:\d+: undefined name 'GenericGetTestCase'
greentest/test__server_pywsgi.py:
'''
IGNORED = IGNORED.strip().replace(' *', ' \\*').split('\n')
def is_ignored(line):
for pattern in IGNORED:
if re.match(pattern, line):
return True
popen = subprocess.Popen('pyflakes gevent/ examples/ greentest/*.py util/ *.py', shell=True, stdout=subprocess.PIPE)
output, _err = popen.communicate()
if popen.poll() != 1:
sys.stderr.write(output + '\n')
sys.exit('pyflakes returned %r' % popen.poll())
assert output
output = output.strip().split('\n')
failed = False
for line in output:
line = line.strip()
if not is_ignored(line):
print 'E %s' % line
failed = True
#else:
# print 'I %s' % line
if failed:
sys.exit(1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment