Skip to content

Commit ec6fca4

Browse files
committedSep 5, 2018
Add codecov support to AppVeyor and remove coveralls
1 parent 410d576 commit ec6fca4

8 files changed

+46
-45
lines changed
 

‎.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CHANGELOG merge=union
1+
*.bat text eol=crlf

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ env/
3535
.cache
3636
.pytest_cache
3737
.coverage
38+
.coverage.*
39+
coverage.xml
3840
.ropeproject
3941
.idea
4042
.hypothesis

‎.travis.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ jobs:
8282
before_script:
8383
- |
8484
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
85-
export _PYTEST_TOX_COVERAGE_RUN="env COVERAGE_FILE=$PWD/.coverage COVERAGE_PROCESS_START=$PWD/.coveragerc coverage run --source {envsitepackagesdir}/_pytest/,$PWD/testing -m"
85+
export COVERAGE_FILE="$PWD/.coverage"
86+
export COVERAGE_PROCESS_START="$PWD/.coveragerc"
87+
export _PYTEST_TOX_COVERAGE_RUN="coverage run --source {envsitepackagesdir}/_pytest/,{toxinidir}/testing -m"
8688
export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
8789
fi
8890
@@ -94,9 +96,9 @@ after_success:
9496
set -e
9597
pip install codecov
9698
coverage combine
97-
coverage xml
98-
coverage report -m
99-
codecov --required -X gcov pycov search -f coverage.xml --flags ${TOXENV//-/ }
99+
coverage xml --ignore-errors
100+
coverage report -m --ignore-errors
101+
codecov --required -X gcov pycov search -f coverage.xml --flags ${TOXENV//-/ } linux
100102
101103
# Coveralls does not support merged reports.
102104
if [[ "$TOXENV" = py37 ]]; then

‎appveyor.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
environment:
2-
COVERALLS_REPO_TOKEN:
3-
secure: 2NJ5Ct55cHJ9WEg3xbSqCuv0rdgzzb6pnzOIG5OkMbTndw3wOBrXntWFoQrXiMFi
4-
# this is pytest's token in coveralls.io, encrypted
5-
# using pytestbot account as detailed here:
6-
# https://www.appveyor.com/docs/build-configuration#secure-variables
7-
82
matrix:
9-
# coveralls is not in the default env list
10-
- TOXENV: "coveralls"
11-
# note: please use "tox --listenvs" to populate the build matrix below
123
- TOXENV: "linting"
4+
PYTEST_NO_COVERAGE: "1"
135
- TOXENV: "py27"
146
- TOXENV: "py34"
157
- TOXENV: "py35"
168
- TOXENV: "py36"
179
- TOXENV: "py37"
1810
- TOXENV: "pypy"
19-
- TOXENV: "py27-pexpect"
11+
PYTEST_NO_COVERAGE: "1"
2012
- TOXENV: "py27-xdist"
2113
- TOXENV: "py27-trial"
2214
- TOXENV: "py27-numpy"
2315
- TOXENV: "py27-pluggymaster"
24-
- TOXENV: "py36-pexpect"
2516
- TOXENV: "py36-xdist"
2617
- TOXENV: "py36-trial"
2718
- TOXENV: "py36-numpy"
2819
- TOXENV: "py36-pluggymaster"
2920
- TOXENV: "py27-nobyte"
3021
- TOXENV: "doctesting"
3122
- TOXENV: "py36-freeze"
23+
PYTEST_NO_COVERAGE: "1"
3224
- TOXENV: "docs"
25+
PYTEST_NO_COVERAGE: "1"
3326

3427
install:
3528
- echo Installed Pythons
3629
- dir c:\Python*
3730

3831
- if "%TOXENV%" == "pypy" call scripts\install-pypy.bat
3932

33+
- C:\Python36\python -m pip install --upgrade pip
4034
- C:\Python36\python -m pip install --upgrade --pre tox
4135

4236
build: false # Not a C# project, build stuff at the test step instead.
4337

38+
before_test:
39+
- call scripts\prepare-coverage.bat
40+
4441
test_script:
45-
- call scripts\call-tox.bat
42+
- C:\Python36\python -m tox
43+
44+
on_success:
45+
- call scripts\upload-coverage.bat
4646

4747
cache:
4848
- '%LOCALAPPDATA%\pip\cache'

‎scripts/call-tox.bat

-8
This file was deleted.

‎scripts/prepare-coverage.bat

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
REM scripts called by AppVeyor to setup the environment variables to enable coverage
2+
if not defined PYTEST_NO_COVERAGE (
3+
set "COVERAGE_FILE=%CD%\.coverage"
4+
set "COVERAGE_PROCESS_START=%CD%\.coveragerc"
5+
set "_PYTEST_TOX_COVERAGE_RUN=coverage run --source {envsitepackagesdir}/_pytest/,{toxinidir}/testing -m"
6+
set "_PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess"
7+
echo Coverage setup completed
8+
) else (
9+
echo Skipping coverage setup, PYTEST_NO_COVERAGE is set
10+
)

‎scripts/upload-coverage.bat

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
REM script called by AppVeyor to combine and upload coverage information to codecov
2+
if not defined PYTEST_NO_COVERAGE (
3+
echo Prepare to upload coverage information
4+
C:\Python36\Scripts\pip install codecov
5+
C:\Python36\Scripts\coverage combine
6+
C:\Python36\Scripts\coverage xml --ignore-errors
7+
C:\Python36\Scripts\coverage report -m --ignore-errors
8+
C:\Python36\Scripts\codecov --required -X gcov pycov search -f coverage.xml --flags %TOXENV:-= % windows
9+
) else (
10+
echo Skipping coverage upload, PYTEST_NO_COVERAGE is set
11+
)

‎tox.ini

+4-20
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ envlist =
1818

1919
[testenv]
2020
commands =
21-
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {env:_PYTEST_TEST_OPTS:} {posargs:testing}
22-
coverage: coverage report -m --skip-covered
21+
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {posargs:testing}
22+
passenv = USER USERNAME
2323
setenv =
24+
# configuration if a user runs tox with a "coverage" factor, for example "tox -e py36-coverage"
2425
coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m
2526
coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
2627
coverage: COVERAGE_FILE={toxinidir}/.coverage
2728
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
28-
passenv = USER USERNAME
2929
deps =
3030
hypothesis>=3.56
3131
nose
@@ -56,9 +56,8 @@ deps =
5656
nose
5757
hypothesis>=3.56
5858
{env:_PYTEST_TOX_EXTRA_DEP:}
59-
changedir=testing
6059
commands =
61-
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n8 -ra {posargs:.}
60+
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n8 -ra {posargs:testing}
6261

6362
[testenv:py36-xdist]
6463
deps = {[testenv:py27-xdist]deps}
@@ -177,21 +176,6 @@ commands =
177176
{envpython} create_executable.py
178177
{envpython} tox_run.py
179178

180-
181-
[testenv:coveralls]
182-
passenv = CI TRAVIS TRAVIS_* COVERALLS_REPO_TOKEN
183-
usedevelop = True
184-
changedir = .
185-
deps =
186-
{[testenv]deps}
187-
coveralls
188-
codecov
189-
commands =
190-
coverage run -m pytest testing
191-
coverage report -m
192-
coveralls
193-
codecov
194-
195179
[testenv:release]
196180
decription = do a release, required posarg of the version number
197181
basepython = python3.6

0 commit comments

Comments
 (0)
Please sign in to comment.