Skip to content

Commit

Permalink
Collect PyPy and AppVeyor coverage using tox
Browse files Browse the repository at this point in the history
Coverage of PyPy was disabled however it works
without trouble, albeit a little slow.

To allow tox to run tests under coverage,
and with arguments passed to coverage,
PYTEST_COMMAND can now be used to override
the default command used to run the tests.

Due to pips inability to deal with multiple
requirements for the same package, six==1.9 is
forcably installed after the tox environment
has been setup.
  • Loading branch information
jayvdb committed Nov 29, 2017
1 parent b5137bc commit 943d8c3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
environment:
global:
PATH: "C:\\Python27\\Scripts\\;%PATH%"
PYTEST_COMMAND: "coverage run -m pytest"
matrix:
- TOXENV: py27-base
- TOXENV: py27-optional
Expand All @@ -16,7 +17,7 @@ environment:

install:
- git submodule update --init --recursive
- python -m pip install tox
- python -m pip install tox codecov

build: off

Expand All @@ -25,3 +26,6 @@ test_script:

after_test:
- python debug-info.py

on_success:
- codecov
17 changes: 9 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ sudo: false
cache: pip

env:
- USE_OPTIONAL=true
- USE_OPTIONAL=false
- SIX_VERSION=1.9 USE_OPTIONAL=true
global:
- PYTEST_COMMAND="coverage run -m pytest"
matrix:
- TOXENV=optional
- TOXENV=base
- TOXENV=six19-optional

install:
- ./requirements-install.sh
- pip install tox codecov

script:
- if [[ $TRAVIS_PYTHON_VERSION == pypy* ]]; then py.test; fi
- if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then coverage run -m pytest; fi
- bash flake8-run.sh
- tox

after_script:
- python debug-info.py

after_success:
- if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then codecov; fi
- codecov
4 changes: 4 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
-r requirements.txt

tox

flake8<3.0

pytest
coverage
pytest-expect>=1.1,<2.0
mock
18 changes: 10 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
[tox]
envlist = {py27,py33,py34,py35,py36,pypy}-{base,optional}
envlist = {py27,py33,py34,py35,py36,pypy}-{base,six19,optional}

[testenv]
deps =
flake8<3.0
pytest
pytest-expect>=1.1,<2.0
mock
base: six
base: webencodings
optional: -r{toxinidir}/requirements-optional.txt
-r{toxinidir}/requirements-test.txt
doc: Sphinx

passenv =
PYTEST_COMMAND
COVERAGE_RUN_OPTIONS
commands =
{envbindir}/py.test {posargs}
six19: pip install six==1.9
{env:PYTEST_COMMAND:{envbindir}/py.test} {posargs}
flake8 {toxinidir}

[testenv:doc]
changedir = doc
commands = sphinx-build -b html . _build

[flake8]
exclude = ./.tox

0 comments on commit 943d8c3

Please sign in to comment.