Merge pull request #1226 from Kriechi/travis-tox

use tox in Travis
This commit is contained in:
Aldo Cortesi 2016-06-08 09:06:47 +12:00
commit eb680e7764
3 changed files with 38 additions and 25 deletions

View File

@ -14,20 +14,21 @@ matrix:
fast_finish: true fast_finish: true
include: include:
- python: 2.7 - python: 2.7
env: TOXENV=py27
- python: 2.7 - python: 2.7
env: NO_ALPN=1 env: TOXENV=py27 NO_ALPN=1
- python: 3.5
env: TOXENV=py35
- python: 3.5
env: TOXENV=py35 NO_ALPN=1
- language: generic - language: generic
env: TOXENV=py27
os: osx os: osx
osx_image: xcode7.1 osx_image: xcode7.1
git: git:
depth: 9999999 depth: 9999999
- python: 3.5
env: SCOPE="netlib test/mitmproxy/script test/pathod/test_utils.py test/pathod/test_log.py test/pathod/test_language_generators.py test/pathod/test_language_writer.py test/pathod/test_language_base.py test/pathod/test_language_http.py test/pathod/test_language_websocket.py"
- python: 3.5
env: SCOPE="netlib test/mitmproxy/script test/pathod/test_utils.py test/pathod/test_log.py test/pathod/test_language_generators.py test/pathod/test_language_writer.py test/pathod/test_language_base.py test/pathod/test_language_http.py test/pathod/test_language_websocket.py" NO_ALPN=1
- python: 2.7 - python: 2.7
env: DOCS=1 env: TOXENV=docs
script: 'cd docs && SPHINXOPTS="-W" make -e html'
allow_failures: allow_failures:
- python: pypy - python: pypy
@ -39,23 +40,20 @@ install:
brew outdated openssl || brew upgrade openssl brew outdated openssl || brew upgrade openssl
brew install python brew install python
fi fi
- pip install -U virtualenv codecov
- ./dev.sh
- source venv/bin/activate
before_script: before_script:
- "openssl version -a" - "pip install tox"
- "python -c \"from OpenSSL import SSL; print(SSL.SSLeay_version(SSL.SSLEAY_VERSION))\"" - "tox -e lint"
- "flake8 --jobs 4 --count mitmproxy netlib pathod examples test"
script: script: tox
- "py.test --timeout 60 --cov netlib --cov mitmproxy --cov pathod test/$SCOPE"
after_success: after_success:
- codecov
- | - |
if [[ $TRAVIS_OS_NAME == "osx" && $TRAVIS_PULL_REQUEST == "false" && ($TRAVIS_BRANCH == "master" || -n $TRAVIS_TAG) ]] if [[ $TRAVIS_OS_NAME == "osx" && $TRAVIS_PULL_REQUEST == "false" && ($TRAVIS_BRANCH == "master" || -n $TRAVIS_TAG) ]]
then then
pip install -U virtualenv
./dev.sh
source venv/bin/activate
pip install -e ./release pip install -e ./release
python ./release/rtool.py bdist python ./release/rtool.py bdist
python ./release/rtool.py upload-snapshot --bdist --wheel python ./release/rtool.py upload-snapshot --bdist --wheel
@ -71,7 +69,6 @@ notifications:
cache: cache:
directories: directories:
- $HOME/build/mitmproxy/mitmproxy/venv - $HOME/build/mitmproxy/mitmproxy/.tox
- $HOME/.cache/pip - $HOME/.cache/pip
- $HOME/.pyenv - $HOME/.pyenv
- $HOME/Library/Caches/pip

View File

@ -97,8 +97,8 @@ setup(
"ipaddress>=1.0.15, <1.1", "ipaddress>=1.0.15, <1.1",
], ],
'dev': [ 'dev': [
"tox>=2.3, <3",
"mock>=2.0, <2.1", "mock>=2.0, <2.1",
"flake8>=2.5.4, <3",
"pytest>=2.8.7, <2.10", "pytest>=2.8.7, <2.10",
"pytest-cov>=2.2.1, <2.3", "pytest-cov>=2.2.1, <2.3",
"pytest-timeout>=1.0.0, <1.1", "pytest-timeout>=1.0.0, <1.1",

28
tox.ini
View File

@ -1,15 +1,31 @@
[tox] [tox]
envlist = py27, py35, lint envlist = py27, py35, docs, lint
[testenv] [testenv]
deps = -rrequirements.txt deps =
-rrequirements.txt
codecov>=2.0.5
passenv = CI TRAVIS_BUILD_ID TRAVIS TRAVIS_BRANCH TRAVIS_JOB_NUMBER TRAVIS_PULL_REQUEST TRAVIS_JOB_ID TRAVIS_REPO_SLUG TRAVIS_COMMIT
[testenv:py27] [testenv:py27]
commands = py.test -n 8 --timeout 60 ./test commands =
py.test --cov netlib --cov mitmproxy --cov pathod --color=yes --timeout 60 ./test
codecov -e TOXENV
[testenv:py35] [testenv:py35]
commands = py.test -n 8 --timeout 60 test/netlib test/mitmproxy/script test/pathod/test_utils.py test/pathod/test_log.py test/pathod/test_language_generators.py test/pathod/test_language_writer.py test/pathod/test_language_base.py test/pathod/test_language_http.py test_language_websocket.py # remove bash & pipe & grep hack after cryptography ships with openssl 1.1.0
whitelist_externals = bash
commands =
bash -c 'py.test --cov netlib --cov mitmproxy --cov pathod --color=yes --timeout 60 test/netlib test/mitmproxy/script test/pathod/test_utils.py test/pathod/test_log.py test/pathod/test_language_generators.py test/pathod/test_language_writer.py test/pathod/test_language_base.py test/pathod/test_language_http.py test/pathod/test_language_websocket.py 2>&1 | grep -v Cryptography_locking_cb'
codecov -e TOXENV
[testenv:docs]
basepython = python2.7
whitelist_externals = make
changedir = docs
setenv = SPHINXOPTS="-W"
commands = make -e html
[testenv:lint] [testenv:lint]
deps = flake8 deps = flake8>=2.5.4, <3
commands = flake8 --count mitmproxy netlib pathod examples test commands = flake8 --jobs 8 --count mitmproxy netlib pathod examples test