diff --git a/prediction/requirements/local.txt b/prediction/requirements/local.txt index 99695ed6..6385892d 100644 --- a/prediction/requirements/local.txt +++ b/prediction/requirements/local.txt @@ -1,3 +1,4 @@ flake8==3.3.0 pytest==3.1.3 pylidc==0.1.9 # Fixes UnicodeDecodeError in to_volume() (https://github.com/pylidc/pylidc/issues/9) +coverage==4.4.2 diff --git a/tests/test_docker.sh b/tests/test_docker.sh index 4b10d68e..e4b4569d 100644 --- a/tests/test_docker.sh +++ b/tests/test_docker.sh @@ -7,10 +7,14 @@ set -ex # run the model service's tests -docker-compose -f local.yml run prediction pytest -rsx +# Coverage should ignore pip packets, files including tests and pytest +docker-compose -f local.yml run prediction coverage run --branch --omit=/**/dist-packages/*,src/tests/*,/usr/local/bin/pytest /usr/local/bin/pytest -rsx +docker-compose -f local.yml run prediction coverage report # run the backend API tests -docker-compose -f local.yml run interface python manage.py test +# Coverage should ignore pip packets, files including migrations and tests +docker-compose -f local.yml run interface coverage run --branch --omit=/**/dist-packages/*,**/migrations/*.py,**/test*.py manage.py test +docker-compose -f local.yml run interface coverage report # return non-zero status code if there are migrations that have not been created docker-compose -f local.yml run interface python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }