Skip to content

Commit 1c2bb37

Browse files
committed
Add command to measure test coverage.
1 parent 96f1cb4 commit 1c2bb37

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
*.pyc
22
*.DS_Store
33
*~
4+
build
5+
.coverage
6+
dist
47
django_debug_toolbar.egg-info
58
docs/_build
69
example/db.sqlite3
7-
/dist
8-
/build
9-
/.tox
10+
htmlcov
11+
.tox

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
# Make file to compress and join all JS files
22
all: compress_js compress_css
33

4+
5+
46
.PHONY: flake8 example test compress_js compress_css translatable_strings update_translations
57

68
flake8:
79
flake8 debug_toolbar example tests
810

911
example:
10-
PYTHONPATH=. django-admin.py runserver --settings=example.settings
12+
DJANGO_SETTINGS_MODULE=example.settings PYTHONPATH=. \
13+
django-admin.py runserver
1114

1215
test:
13-
PYTHONPATH=. django-admin.py test --settings=tests.settings tests
16+
DJANGO_SETTINGS_MODULE=tests.settings PYTHONPATH=. \
17+
django-admin.py test tests
18+
19+
coverage:
20+
coverage erase
21+
DJANGO_SETTINGS_MODULE=tests.settings PYTHONPATH=. \
22+
coverage run --branch --source=debug_toolbar `which django-admin.py` test tests
23+
coverage html
1424

1525
compress_js:
1626
yuicompressor debug_toolbar/static/debug_toolbar/js/jquery.js > debug_toolbar/static/debug_toolbar/js/toolbar.min.js

docs/contributing.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ environment::
3535

3636
$ make test
3737

38+
You can enable coverage measurement during tests::
39+
40+
$ make coverage
41+
3842
You can also run the test suite on all supported versions of Django and
3943
Python::
4044

requirements_dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ sqlparse
99

1010
# Testing
1111

12+
coverage
1213
flake8
1314
tox
1415

0 commit comments

Comments
 (0)