Skip to content

Commit

Permalink
Merge pull request #530 from moreati/cover-us
Browse files Browse the repository at this point in the history
 Aggregate code coverage data across all tox runs
  • Loading branch information
dw committed Feb 9, 2019
2 parents a6fd080 + 2b1035b commit 9a41e17
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,16 @@ Core Library
* `#524 <https://github.com/dw/mitogen/issues/524>` : Python 3.6+ emitted a
:class:`DeprecationWarning` for :func:`mitogen.utils.run_with_router`.

* `#529 <https://github.com/dw/mitogen/issues/529>` : Code coverage of the
test suite was not measured across all Python versions.


Thanks!
~~~~~~~

Mitogen would not be possible without the support of users. A huge thanks for
bug reports, testing, features and fixes in this release contributed by
`Alex Willmer <https://github.com/moreati>`_,
`Andreas Krüger <https://github.com/woopstar>`_,
`Anton Stroganov <https://github.com/Aeon>`_,
`Berend De Schouwer <https://github.com/berenddeschouwer>`_,
Expand Down
18 changes: 13 additions & 5 deletions run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@ echo
# Don't use errexit, so coverage report is still generated when tests fail
set -o pipefail

NOCOVERAGE="${NOCOVERAGE:-}"
NOCOVERAGE_ERASE="${NOCOVERAGE_ERASE:-$NOCOVERAGE}"
NOCOVERAGE_REPORT="${NOCOVERAGE_REPORT:-$NOCOVERAGE}"

if [ ! "$UNIT2" ]; then
UNIT2="$(which unit2)"
fi

[ "$NOCOVERAGE" ] || coverage erase
if [ ! "$NOCOVERAGE_ERASE" ]; then
coverage erase
fi

# First run overwites coverage output.
[ "$SKIP_MITOGEN" ] || {
if [ ! "$NOCOVERAGE" ]; then
coverage run "${UNIT2}" discover \
coverage run -a "${UNIT2}" discover \
--start-directory "tests" \
--pattern '*_test.py' \
"$@"
Expand All @@ -59,16 +65,18 @@ fi
--pattern '*_test.py' \
"$@"
else
coverage run -a "${UNIT2}" discover \
"${UNIT2}" discover \
--start-directory "tests/ansible" \
--pattern '*_test.py' \
"$@"
fi
ANSIBLE_TEST_STATUS=$?
}

[ "$NOCOVERAGE" ] || coverage html
[ "$NOCOVERAGE" ] || echo coverage report is at "file://$(pwd)/htmlcov/index.html"
if [ ! "$NOCOVERAGE_REPORT" ]; then
coverage html
echo "coverage report is at file://$(pwd)/htmlcov/index.html"
fi

# Exit with a non-zero status if any test run did so
exit "$(max $MITOGEN_TEST_STATUS $ANSIBLE_TEST_STATUS)"
20 changes: 20 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[tox]
envlist =
init,
py26,
py27,
py35,
py36,
py37,
report,

[testenv]
usedevelop = True
Expand All @@ -16,6 +18,24 @@ commands =
{posargs:bash run_tests}
whitelist_externals =
bash
setenv =
NOCOVERAGE_ERASE = 1
NOCOVERAGE_REPORT = 1

[testenv:init]
commands =
coverage erase
deps =
coverage

[testenv:report]
commands =
coverage html
echo "coverage report is at file://{toxinidir}/htmlcov/index.html"
deps =
coverage
whitelist_externals =
echo

[testenv:docs]
basepython = python
Expand Down

0 comments on commit 9a41e17

Please sign in to comment.