diff --git a/.travis.yml b/.travis.yml index dad81c379..b0a4ea10d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,20 +14,21 @@ matrix: fast_finish: true include: - python: 2.7 + env: TOXENV=py27 - 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 + env: TOXENV=py27 os: osx osx_image: xcode7.1 git: 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 - env: DOCS=1 - script: 'cd docs && SPHINXOPTS="-W" make -e html' + env: TOXENV=docs allow_failures: - python: pypy @@ -39,23 +40,20 @@ install: brew outdated openssl || brew upgrade openssl brew install python fi - - pip install -U virtualenv codecov - - ./dev.sh - - source venv/bin/activate before_script: - - "openssl version -a" - - "python -c \"from OpenSSL import SSL; print(SSL.SSLeay_version(SSL.SSLEAY_VERSION))\"" - - "flake8 --jobs 4 --count mitmproxy netlib pathod examples test" + - "pip install tox" + - "tox -e lint" -script: - - "py.test --timeout 60 --cov netlib --cov mitmproxy --cov pathod test/$SCOPE" +script: tox after_success: - - codecov - | if [[ $TRAVIS_OS_NAME == "osx" && $TRAVIS_PULL_REQUEST == "false" && ($TRAVIS_BRANCH == "master" || -n $TRAVIS_TAG) ]] then + pip install -U virtualenv + ./dev.sh + source venv/bin/activate pip install -e ./release python ./release/rtool.py bdist python ./release/rtool.py upload-snapshot --bdist --wheel @@ -71,7 +69,6 @@ notifications: cache: directories: - - $HOME/build/mitmproxy/mitmproxy/venv + - $HOME/build/mitmproxy/mitmproxy/.tox - $HOME/.cache/pip - $HOME/.pyenv - - $HOME/Library/Caches/pip diff --git a/setup.py b/setup.py index e8829d492..050043b36 100644 --- a/setup.py +++ b/setup.py @@ -97,8 +97,8 @@ setup( "ipaddress>=1.0.15, <1.1", ], 'dev': [ + "tox>=2.3, <3", "mock>=2.0, <2.1", - "flake8>=2.5.4, <3", "pytest>=2.8.7, <2.10", "pytest-cov>=2.2.1, <2.3", "pytest-timeout>=1.0.0, <1.1", diff --git a/tox.ini b/tox.ini index 9fb563a0d..b75f536ff 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,31 @@ [tox] -envlist = py27, py35, lint +envlist = py27, py35, docs, lint [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] -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] -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] -deps = flake8 -commands = flake8 --count mitmproxy netlib pathod examples test +deps = flake8>=2.5.4, <3 +commands = flake8 --jobs 8 --count mitmproxy netlib pathod examples test