Skip to content

Commit c99bcb2

Browse files
committed
Collect PyPy and AppVeyor coverage using tox
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, and COVERAGE_RUN_OPTIONS is passed through. 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.
1 parent e143e99 commit c99bcb2

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

.appveyor.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# To activate, change the Appveyor settings to use `.appveyor.yml`.
2-
init:
3-
- SET PATH=C:\\Python27\\Scripts\\;%PATH%"
2+
environment:
3+
PATH: "C:\\Python27\\Scripts\\;%PATH%"
4+
PYTEST_COMMAND: "coverage run -m pytest"
5+
COVERAGE_RUN_OPTIONS: --parallel-mode
46

57
install:
68
- git submodule update --init --recursive
7-
- python -m pip install tox
9+
- python -m pip install tox codecov
810

911
build: off
1012

@@ -14,3 +16,7 @@ test_script:
1416

1517
after_test:
1618
- python debug-info.py
19+
20+
on_success:
21+
- coverage combine
22+
- codecov

.travis.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,21 @@ sudo: false
1212
cache: pip
1313

1414
env:
15-
- USE_OPTIONAL=true
16-
- USE_OPTIONAL=false
17-
- SIX_VERSION=1.9 USE_OPTIONAL=true
15+
global:
16+
- PYTEST_COMMAND="coverage run -m pytest"
17+
matrix:
18+
- TOXENV=optional
19+
- TOXENV=base
20+
- TOXENV=six19
1821

1922
install:
20-
- ./requirements-install.sh
23+
- pip install tox codecov
2124

2225
script:
23-
- if [[ $TRAVIS_PYTHON_VERSION == pypy* ]]; then py.test; fi
24-
- if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then coverage run -m pytest; fi
25-
- bash flake8-run.sh
26+
- tox
2627

2728
after_script:
2829
- python debug-info.py
2930

3031
after_success:
31-
- if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then codecov; fi
32+
- codecov

requirements-test.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
-r requirements.txt
22

3+
tox
4+
35
flake8<3.0
6+
47
pytest
8+
coverage
59
pytest-expect>=1.1,<2.0
610
mock

tox.ini

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
[tox]
2-
envlist = {py27,py33,py34,py35,py36,pypy}-{base,optional}
2+
envlist = {py27,py33,py34,py35,py36,pypy}-{base,six19,optional}
33

44
[testenv]
55
deps =
6-
flake8<3.0
7-
pytest
8-
pytest-expect>=1.1,<2.0
9-
mock
10-
base: six
11-
base: webencodings
126
optional: -r{toxinidir}/requirements-optional.txt
7+
-r{toxinidir}/requirements-test.txt
138
doc: Sphinx
149

10+
passenv =
11+
PYTEST_COMMAND
12+
COVERAGE_RUN_OPTIONS
1513
commands =
16-
{envbindir}/py.test {posargs}
14+
six19: pip install six==1.9
15+
{env:PYTEST_COMMAND:{envbindir}/py.test} {posargs}
1716
flake8 {toxinidir}
1817

1918
[testenv:doc]
2019
changedir = doc
2120
commands = sphinx-build -b html . _build
21+
22+
[flake8]
23+
exclude = ./.tox

0 commit comments

Comments
 (0)