Skip to content

Commit d9764c0

Browse files
committed
Added coverage stats (with nose), and testing instructions to the readme.
1 parent d501ba7 commit d9764c0

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

README.rst

+7
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ Add this to the top of any template:
1616
And drop the filter anywhere you have a model instance (e.g., DetailViews):
1717

1818
{{ object|as_detail_html }}
19+
20+
Running Tests
21+
-------------
22+
23+
$ python tests.py --with-coverage --cover-package=model_filters
24+
25+
Run it before and after you make any changes. Try to not let that number drop.

example_project/settings.py

+4
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,15 @@
117117
'django.contrib.staticfiles',
118118
'django.contrib.admin',
119119

120+
'django_nose',
121+
120122
'model_filters',
121123

122124
'pepulator_factory',
123125
)
124126

127+
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
128+
125129
# A sample logging configuration. The only tangible logging
126130
# performed by this configuration is to send an email to
127131
# the site admins on every HTTP 500 error.

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
Django
22
mock
3+
django-nose
4+
coverage

tests.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
python setup.py test
3+
4+
"""
5+
import os
6+
import sys
7+
8+
os.environ["DJANGO_SETTINGS_MODULE"] = 'example_project.settings'
9+
from example_project import settings
10+
11+
settings.INSTALLED_APPS = (
12+
# 'django.contrib.auth',
13+
# 'django.contrib.sessions',
14+
# 'django.contrib.contenttypes',
15+
# 'django.contrib.admin',
16+
# 'django.contrib.sites',
17+
# 'demo_project.profiles',
18+
'model_filters',
19+
)
20+
21+
def main():
22+
from django.test.utils import get_runner
23+
test_runner = get_runner(settings)(interactive=False)
24+
failures = test_runner.run_tests(['model_filters',])
25+
sys.exit(failures)
26+
27+
if __name__ == '__main__':
28+
main()

0 commit comments

Comments
 (0)