From bac3e87538d5398eb637fb26560705886c4fcfd1 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 10 Jun 2016 16:03:54 +1200 Subject: [PATCH 1/4] Distinguish between CI and interactive versions of tox - This patch changes tox so that local invocation runs the tests with paralellism, coverage disabled, and without attempting to report coverage upstream. - You can now run specific tests for the py27 environment: tox -e py27 ./path/to/my/test We can't do this for py35 just yet, because of our junk filter, and the fact that we specify which tests to run directly in the conf file. Once these are cleaned up, we can extend. --- .travis.yml | 12 ++++++------ tox.ini | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index b0a4ea10d..3c48eb39b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,15 +14,15 @@ matrix: fast_finish: true include: - python: 2.7 - env: TOXENV=py27 + env: TOXENV=py27-ci - python: 2.7 - env: TOXENV=py27 NO_ALPN=1 + env: TOXENV=py27-ci NO_ALPN=1 - python: 3.5 - env: TOXENV=py35 + env: TOXENV=py35-ci - python: 3.5 - env: TOXENV=py35 NO_ALPN=1 + env: TOXENV=py35-ci NO_ALPN=1 - language: generic - env: TOXENV=py27 + env: TOXENV=py27-ci os: osx osx_image: xcode7.1 git: @@ -40,9 +40,9 @@ install: brew outdated openssl || brew upgrade openssl brew install python fi + - pip install tox tox-travis before_script: - - "pip install tox" - "tox -e lint" script: tox diff --git a/tox.ini b/tox.ini index d1b02463b..2ae4a8a92 100644 --- a/tox.ini +++ b/tox.ini @@ -9,12 +9,24 @@ passenv = CI TRAVIS_BUILD_ID TRAVIS TRAVIS_BRANCH TRAVIS_JOB_NUMBER TRAVIS_PULL_ [testenv:py27] commands = - py.test --cov netlib --cov mitmproxy --cov pathod --color=yes --timeout 60 ./test - codecov -e TOXENV + py.test -n 8 --color=yes --timeout 60 [] [testenv:py35] # remove bash & pipe & grep hack after cryptography ships with openssl 1.1.0 whitelist_externals = bash +commands = + bash -c 'set -o pipefail ; py.test -n 8 --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 test/pathod/test_language_http2.py 2>&1 | grep -v Cryptography_locking_cb' + +[testenv:py27-ci] +basepython = python2.7 +commands = + py.test --cov netlib --cov mitmproxy --cov pathod --color=yes --timeout 60 ./test + codecov -e TOXENV + +[testenv:py35-ci] +# remove bash & pipe & grep hack after cryptography ships with openssl 1.1.0 +basepython = python3.5 +whitelist_externals = bash commands = bash -c 'set -o pipefail ; 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 test/pathod/test_language_http2.py 2>&1 | grep -v Cryptography_locking_cb' codecov -e TOXENV From 6da3ef48e09cf459b49bbf4201c42d6ee2d03935 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 10 Jun 2016 19:38:55 +1200 Subject: [PATCH 2/4] Remove explicit versions in tox CI environments Tox matches the environment prefix against its std environs, so we don't need to be explicit with versions here. --- tox.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/tox.ini b/tox.ini index 2ae4a8a92..85b3429e3 100644 --- a/tox.ini +++ b/tox.ini @@ -18,14 +18,12 @@ commands = bash -c 'set -o pipefail ; py.test -n 8 --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 test/pathod/test_language_http2.py 2>&1 | grep -v Cryptography_locking_cb' [testenv:py27-ci] -basepython = python2.7 commands = py.test --cov netlib --cov mitmproxy --cov pathod --color=yes --timeout 60 ./test codecov -e TOXENV [testenv:py35-ci] # remove bash & pipe & grep hack after cryptography ships with openssl 1.1.0 -basepython = python3.5 whitelist_externals = bash commands = bash -c 'set -o pipefail ; 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 test/pathod/test_language_http2.py 2>&1 | grep -v Cryptography_locking_cb' From 3f7dc296c84f435154591526264711563ad2e98d Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 10 Jun 2016 20:05:18 +1200 Subject: [PATCH 3/4] We're not using tox-travis any more - ditch it. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3c48eb39b..a01bf0551 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ install: brew outdated openssl || brew upgrade openssl brew install python fi - - pip install tox tox-travis + - pip install tox before_script: - "tox -e lint" From 250b47487aa071e61f0bd2960992e80222103a3a Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 11 Jun 2016 09:34:40 +1200 Subject: [PATCH 4/4] tox: Pull Py3 test list out into an environment variable Suggestion from @resam --- tox.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 85b3429e3..ffd78359a 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,8 @@ 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 +setenv = + PY3TESTS = 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 test/pathod/test_language_http2.py [testenv:py27] commands = @@ -15,7 +17,7 @@ commands = # remove bash & pipe & grep hack after cryptography ships with openssl 1.1.0 whitelist_externals = bash commands = - bash -c 'set -o pipefail ; py.test -n 8 --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 test/pathod/test_language_http2.py 2>&1 | grep -v Cryptography_locking_cb' + bash -c 'set -o pipefail ; py.test -n 8 --color=yes --timeout 60 {env:PY3TESTS:} 2>&1 | grep -v Cryptography_locking_cb' [testenv:py27-ci] commands = @@ -26,7 +28,7 @@ commands = # remove bash & pipe & grep hack after cryptography ships with openssl 1.1.0 whitelist_externals = bash commands = - bash -c 'set -o pipefail ; 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 test/pathod/test_language_http2.py 2>&1 | grep -v Cryptography_locking_cb' + bash -c 'set -o pipefail ; py.test --cov netlib --cov mitmproxy --cov pathod --color=yes --timeout 60 {env:PY3TESTS:} 2>&1 | grep -v Cryptography_locking_cb' codecov -e TOXENV [testenv:docs]