Add test coverage support

Prints out results on console and puts HTML report in `coverage-html`.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
This commit is contained in:
Ben Firshman 2015-05-28 19:02:19 +01:00
parent 81707ef1ad
commit aab6df6ba4
5 changed files with 8 additions and 1 deletions

View File

@ -2,3 +2,4 @@
build
dist
venv
coverage-html

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
/docs/_site
/venv
docker-compose.spec
coverage-html

View File

@ -4,3 +4,4 @@ git+https://github.com/pyinstaller/pyinstaller.git@12e40471c77f588ea5be352f7219c
unittest2==0.8.0
flake8==2.3.0
pep8==1.6.1
coverage==3.7.1

View File

@ -5,6 +5,8 @@ set -ex
TAG="docker-compose:$(git rev-parse --short HEAD)"
rm -rf coverage-html
docker build -t "$TAG" .
docker run \
--rm \
@ -12,6 +14,7 @@ docker run \
-e DOCKER_VERSIONS \
-e "TAG=$TAG" \
-e "affinity:image==$TAG" \
-e "COVERAGE_DIR=$(pwd)/coverage-html" \
--entrypoint="script/test-versions" \
"$TAG" \
"$@"

View File

@ -19,8 +19,9 @@ for version in $DOCKER_VERSIONS; do
--rm \
--privileged \
--volume="/var/lib/docker" \
--volume="${COVERAGE_DIR:-$(pwd)/coverage-html}:/code/coverage-html" \
-e "DOCKER_VERSION=$version" \
--entrypoint="script/dind" \
"$TAG" \
script/wrapdocker nosetests "$@"
script/wrapdocker nosetests --with-coverage --cover-branches --cover-package=compose --cover-erase --cover-html-dir=coverage-html --cover-html "$@"
done