Commit 955dbc61 authored by Jason Madden's avatar Jason Madden

Add Tox environments for running linters and include one in the default env...

Add Tox environments for running linters and include one in the default env list. Add a Tox environment for running leak tests and one for doing both, but do not run them by default. Unify the Travis and Tox configurations, and make Travis run both leak and lint tests. Switch the leak test from using gettotalrefcount (only available in debug builds) to using len(gc.get_objects()); while this is not exactly the same thing, it make be close enough, and it's avaialble to every Python developer unlike gettotalrefcount.
parent 3b8e9544
[pep8]
ignore=E702,E265,E402,E731,E266
ignore=E702,E265,E402,E731,E266,E261
max_line_length=160
exclude=.git,build,2.6,2.7,2.7pypy,3.3,test_support.py,test_queue.py,patched_tests_setup.py,test_threading_2.py,lock_tests.py,_sslgte279.py
exclude=.tox,.git,build,2.6,2.7,2.7pypy,3.3,test_support.py,test_queue.py,patched_tests_setup.py,test_threading_2.py,lock_tests.py,_sslgte279.py
language: python
sudo: false
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "pypy"
- TOXENV=py26
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=pypy
- TOXENV=travis-lint
install:
- travis_retry pip install tox
script:
- if [[ $TRAVIS_PYTHON_VERSION == 'pypy' ]]; then NWORKERS=4 PYTHON=pypy make travis_pypy; fi
- if [[ $TRAVIS_PYTHON_VERSION != 'pypy' ]]; then NWORKERS=4 PYTHON=python$TRAVIS_PYTHON_VERSION make travis_cpython; fi
- tox
notifications:
email: false
......@@ -35,7 +35,7 @@ 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/*" -not -path "./doc/mytheme/static/*" -type f | xargs egrep -l " $$"
! find . -not -path "./.tox/*" -not -path "*/__pycache__/*" -not -path "*.pyc" -not -path "./.git/*" -not -path "./build/*" -not -path "./libev/*" -not -path "./gevent/libev/*" -not -path "./gevent.egg-info/*" -not -path "./dist/*" -not -path "./.DS_Store" -not -path "./c-ares/*" -not -path "./gevent/gevent.*.[ch]" -not -path "./gevent/core.pyx" -not -path "./doc/_build/*" -not -path "./doc/mytheme/static/*" -type f | xargs egrep -l " $$"
pep8:
${PYTHON} `which pep8` .
......@@ -43,7 +43,7 @@ pep8:
pyflakes:
${PYTHON} util/pyflakes.py
lint: whitespace pep8 pyflakes
lint: whitespace pyflakes pep8
travistest:
which ${PYTHON}
......@@ -66,11 +66,13 @@ fulltoxtest:
cd greentest && GEVENT_RESOLVER=ares GEVENTARES_SERVERS=8.8.8.8 python testrunner.py --config ../known_failures.py --ignore tests_that_dont_use_resolver.txt
cd greentest && GEVENT_FILE=thread python testrunner.py --config ../known_failures.py `grep -l subprocess test_*.py`
leaktest:
GEVENTSETUP_EV_VERIFY=3 GEVENTTEST_LEAKCHECK=1 make travistest
bench:
${PYTHON} greentest/bench_sendall.py
travis_pypy:
# no need to repeat linters here
which ${PYTHON}
${PYTHON} --version
${PYTHON} setup.py install
......@@ -82,6 +84,9 @@ travis_cpython:
make travistest
travis_test_linters:
make lint
make leaktest
.PHONY: clean all doc pep8 whitespace pyflakes lint travistest travis
......@@ -85,7 +85,7 @@ def wrap_timeout(timeout, method):
def wrap_refcount(method):
if gettotalrefcount is None:
if not os.getenv('GEVENTTEST_LEAKCHECK'):
return method
@wraps(method)
......@@ -98,7 +98,7 @@ def wrap_refcount(method):
gc.disable()
try:
while True:
d = gettotalrefcount()
d = len(gc.get_objects())
self.setUp()
method(self, *args, **kwargs)
self.tearDown()
......@@ -106,7 +106,7 @@ def wrap_refcount(method):
sys.modules['urlparse'].clear_cache()
if 'urllib.parse' in sys.modules:
sys.modules['urllib.parse'].clear_cache()
d = gettotalrefcount() - d
d = len(gc.get_objects()) - d
deltas.append(d)
# the following configurations are classified as "no leak"
# [0, 0]
......
[tox]
envlist =
py26,py27,pypy,py33,py34
py26,py27,pypy,py33,py34,lint
[testenv]
deps =
......@@ -17,3 +17,27 @@ commands =
[testenv:pypy]
deps =
[testenv:lint]
basepython =
python2.7
deps =
{[testenv]deps}
pep8
pyflakes
commands =
make lint
[testenv:travis-lint]
basepython =
python2.7
deps =
{[testenv:lint]deps}
commands =
make travis_test_linters
[testenv:leak]
basepython =
python2.7
commonds =
make leaktest
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