From 1c2bb37e06e97f9a1577f624e4bce4afa56bfcce Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Fri, 1 Nov 2013 21:57:12 +0100 Subject: Add command to measure test coverage. --- .gitignore | 8 +++++--- Makefile | 14 ++++++++++++-- docs/contributing.rst | 4 ++++ requirements_dev.txt | 1 + 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 15863ab..a866e5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ *.pyc *.DS_Store *~ +build +.coverage +dist django_debug_toolbar.egg-info docs/_build example/db.sqlite3 -/dist -/build -/.tox +htmlcov +.tox diff --git a/Makefile b/Makefile index 22832c1..fb87b2f 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,26 @@ # Make file to compress and join all JS files all: compress_js compress_css + + .PHONY: flake8 example test compress_js compress_css translatable_strings update_translations flake8: flake8 debug_toolbar example tests example: - PYTHONPATH=. django-admin.py runserver --settings=example.settings + DJANGO_SETTINGS_MODULE=example.settings PYTHONPATH=. \ + django-admin.py runserver test: - PYTHONPATH=. django-admin.py test --settings=tests.settings tests + DJANGO_SETTINGS_MODULE=tests.settings PYTHONPATH=. \ + django-admin.py test tests + +coverage: + coverage erase + DJANGO_SETTINGS_MODULE=tests.settings PYTHONPATH=. \ + coverage run --branch --source=debug_toolbar `which django-admin.py` test tests + coverage html compress_js: yuicompressor debug_toolbar/static/debug_toolbar/js/jquery.js > debug_toolbar/static/debug_toolbar/js/toolbar.min.js diff --git a/docs/contributing.rst b/docs/contributing.rst index 3151bcd..8c8a49b 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -35,6 +35,10 @@ environment:: $ make test +You can enable coverage measurement during tests:: + + $ make coverage + You can also run the test suite on all supported versions of Django and Python:: diff --git a/requirements_dev.txt b/requirements_dev.txt index 9a4520a..9665bf5 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -9,6 +9,7 @@ sqlparse # Testing +coverage flake8 tox -- cgit v1.2.3