Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[run]
source = _pytest,testing
source = pytest,_pytest,testing/
parallel = 1
branch = 1

[paths]
source = src/
.tox/*/lib/python*/site-packages/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This on Windows would be .tox\*e\Lib\site-packages. Can we add another entry here and coverage will try one and then the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, added .tox\*e\Lib\site-packages\.

This gets used with coverage report - so you could test it after e.g. tox -e py36-coverage -- testing/deprecated_test.py.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm! 🤗

.tox\*\Lib\site-packages\
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ before_script:
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
export COVERAGE_FILE="$PWD/.coverage"
export COVERAGE_PROCESS_START="$PWD/.coveragerc"
export _PYTEST_TOX_COVERAGE_RUN="coverage run --source {envsitepackagesdir}/_pytest/,{toxinidir}/testing -m"
export _PYTEST_TOX_COVERAGE_RUN="coverage run -m"
export _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
fi

Expand All @@ -94,11 +94,11 @@ after_success:
- |
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
set -e
pip install codecov
pip install coverage
coverage combine
coverage xml --ignore-errors
coverage report -m --ignore-errors
codecov --required -X gcov pycov search -f coverage.xml --flags ${TOXENV//-/ } linux
bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -F "${TOXENV//-/,},linux"

# Coveralls does not support merged reports.
if [[ "$TOXENV" = py37 ]]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepare-coverage.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ REM scripts called by AppVeyor to setup the environment variables to enable cove
if not defined PYTEST_NO_COVERAGE (
set "COVERAGE_FILE=%CD%\.coverage"
set "COVERAGE_PROCESS_START=%CD%\.coveragerc"
set "_PYTEST_TOX_COVERAGE_RUN=coverage run --source {envsitepackagesdir}/_pytest/,{toxinidir}/testing -m"
set "_PYTEST_TOX_COVERAGE_RUN=coverage run -m"
set "_PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess"
echo Coverage setup completed
) else (
Expand Down
9 changes: 2 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ envlist =
docs

[testenv]
whitelist_externals = env
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof -ra {posargs:testing}
coverage: coverage combine
coverage: coverage report
passenv = USER USERNAME
setenv =
# configuration if a user runs tox with a "coverage" factor, for example "tox -e py36-coverage"
Expand Down Expand Up @@ -58,7 +59,6 @@ deps =
nose
hypothesis>=3.56
{env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
passenv = USER USERNAME TRAVIS
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto -ra {posargs:testing}
Expand All @@ -79,7 +79,6 @@ platform = linux|darwin
deps =
pexpect
{env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra test_pdb.py test_terminal.py test_unittest.py

Expand All @@ -100,7 +99,6 @@ changedir=testing
setenv =
{[testenv]setenv}
PYTHONDONTWRITEBYTECODE=1
whitelist_externals = env
passenv = USER USERNAME TRAVIS
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto -ra {posargs:.}
Expand All @@ -109,7 +107,6 @@ commands =
deps =
twisted
{env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/test_unittest.py}

Expand All @@ -121,7 +118,6 @@ commands = {[testenv:py27-trial]commands}
deps =
numpy
{env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
commands=
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra {posargs:testing/python/approx.py}

Expand Down Expand Up @@ -157,7 +153,6 @@ skipsdist = True
deps =
PyYAML
{env:_PYTEST_TOX_EXTRA_DEP:}
whitelist_externals = env
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -ra doc/en
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules --pyargs _pytest
Expand Down