diff --git a/.gitignore b/.gitignore index ab791b2e..2f3d166c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ venv/ media/ *.log *.sqlite3 +.coverage # PyCharm .idea diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0ced08d..e5efbf5b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,9 +36,12 @@ before_script: # Remove the old test database if it has not been done yet - psql --username=$POSTGRES_USER --host=$DBHOST -c "DROP DATABASE IF EXISTS test_$POSTGRES_DB" - pip install --upgrade --cache-dir vendor/pip -t vendor/python -r requirements.txt + - pip install coverage - python --version test: stage: test script: - - python manage.py test + - coverage run manage.py test + - coverage report + coverage: '/TOTAL.*\s(\d+\.\d+)\%$/' diff --git a/README.md b/README.md index a0dc5bc1..803ef21f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # GestioCOF ![build_status](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/build.svg) +[![coverage report](https://git.eleves.ens.fr/cof-geek/gestioCOF/badges/master/coverage.svg)](https://git.eleves.ens.fr/cof-geek/gestioCOF/commits/master) ## Installation diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..35eb701a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,16 @@ +[coverage:run] +source = + bda + cof + gestioncof + kfet + shared + utils +omit = + *migrations* + *test*.py +branch = true + +[coverage:report] +precision = 2 +show_missing = true