From 3a26bbe8a08b1943335eaac7271b3c454e8c1bff Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Thu, 16 May 2019 15:44:40 -0400 Subject: [PATCH] Add code coverage --- .coveragerc | 15 +++++++++++++++ .dockerignore | 1 + requirements.txt | 1 + tools/ci.sh | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..4c6a6994 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,15 @@ +[report] +omit = + app/app/wsgi.py + app/classifier/* + app/server/migrations/* + app/server/templatetags/* + app/server/tests/* + +exclude_lines = + pragma: no cover + if __name__ == .__main__. + def __str__ + raise NotImplementedError + +fail_under = 90 diff --git a/.dockerignore b/.dockerignore index 004fc7f3..73541da6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,5 +8,6 @@ app/server/webpack-stats.json !data/ !tests/ !tools/ +!.coveragerc !.flake8 !requirements.txt diff --git a/requirements.txt b/requirements.txt index 177033a4..85240443 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ applicationinsights==0.11.7 +coverage==4.5.3 dj-database-url==0.5.0 Django==2.1.7 django-filter==2.0.0 diff --git a/tools/ci.sh b/tools/ci.sh index 3e4f9592..5f2e8646 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -5,6 +5,7 @@ set -o errexit flake8 python app/manage.py migrate python app/manage.py collectstatic -python app/manage.py test server.tests +coverage run --source=app app/manage.py test server.tests +coverage report (cd app/server && npm run lint)