I’m using django-nose and it does generate a huge coverage report. I would like to filter its output, if possible.
Here is an example of the output:
(venv) C:\Users\fsantos\Desktop\biskates.com\biskates\biskates_project>python manage.py test biskates --with-coverage
nosetests --verbosity 1 biskates --with-coverage
Creating test database for alias 'default'...
.C:\Users\fsantos\Desktop\biskates.com\venv\lib\site-packages\django\db\models\fields\__init__.py:808: RuntimeWarning: DateTimeField received a naive datetime (2012-11-21 18:04:49.075000) while time zone support is active.
RuntimeWarning)
....C:\Users\fsantos\Desktop\biskates.com\venv\lib\site-packages\django\db\models\fields\__init__.py:808: RuntimeWarning: DateTimeField received a naive datetime
(2012-11-21 18:04:51.494000) while time zone support is active.
RuntimeWarning)
...............
Name
Stmts Miss Cover Missing
--------------------------------------------------------------------------------------------------------------------
biskates.managers
26 0 100%
biskates.models
67 0 100%
biskates.templatetags
0 0 100%
biskates.templatetags.biskates
1 0 100%
biskates.views
90 0 100%
biskates_project.urls
19 0 100%
communication.forms
9 0 100%
communication.managers
9 0 100%
communication.models
44 0 100%
communication.views
59 0 100%
debug_toolbar.management
0 0 100%
debug_toolbar.middleware
87 87 0% 4-137
debug_toolbar.models
0 0 100%
debug_toolbar.templatetags
0 0 100%
debug_toolbar.toolbar
0 0 100%
debug_toolbar.toolbar.loader
51 51 0% 4-98
debug_toolbar.urls
3 3 0% 7-11
django.conf.locale
1 1 0% 1
django.conf.locale.en
0 0 100%
django.conf.locale.en.formats
14 14 0% 7-42
django.contrib.admin
19 19 0% 3-41
django.contrib.admin.actions
34 34 0% 5-83
django.contrib.admin.filters
181 181 0% 8-402
django.contrib.admin.forms
27 27 0% 1-43
django.contrib.admin.helpers
245 245 0% 1-352
django.contrib.admin.options
735 735 0% 1-1464
django.contrib.admin.sites
203 203 0% 1-444
django.contrib.admin.templatetags
0 0 100%
django.contrib.admin.templatetags.admin_static
7 7 0% 1-11
django.contrib.admin.util
256 256 0% 1-425
django.contrib.admin.widgets
211 211 0% 5-317
django.contrib.auth.backends
63 63 0% 1-125
django.contrib.auth.context_processors
22 22 0% 4-43
django.contrib.auth.forms
175 175 0% 1-335
django.contrib.auth.hashers
200 200 0% 1-388
django.contrib.auth.management
64 64 0% 4-126
django.contrib.auth.middleware
35 35 0% 1-80
django.contrib.auth.models
244 244 0% 1-476
django.contrib.auth.tokens
33 33 0% 1-71
django.contrib.contenttypes.generic
274 274 0% 5-498
django.contrib.contenttypes.management
34 34 0% 1-79
django.contrib.contenttypes.models
91 91 0% 1-169
django.contrib.contenttypes.views
49 49 0% 1-80
django.contrib.messages.context_processors
3 3 0% 1-8
django.contrib.messages.middleware
11 11 0% 1-26
django.contrib.messages.models
0 0 100%
django.contrib.messages.storage.base
81 81 0% 1-181
django.contrib.messages.storage.cookie
76 76 0% 1-151
django.contrib.messages.storage.fallback
29 29 0% 1-54
(…)
123 123 0% 5-260
south.v2
8 8 0% 6-19
urls
0 0 100%
urls.models
23 2 91% 22, 31
userprofiles.managers
4 0 100%
userprofiles.models
18 1 94% 14
userprofiles.views
4 0 100%
xml.dom.pulldom
270 270 0% 1-351
--------------------------------------------------------------------------------------------------------------------
TOTAL
7625 6826 10%
----------------------------------------------------------------------
Ran 20 tests in 10.996s
OK
Destroying test database for alias 'default'...
(venv) C:\Users\fsantos\Desktop\biskates.com\biskates\biskates_project>
So as to not damage your scrollbar I have removed half of the output.
As you can see, it’s VERY thorough and it’s getting a LOT of information I don’t care about.
I have used django-test-coverage before, but now I want to plunge nose-first into django-nose goodness and don’t want to be bound to write tests subclassing the plain old django TestCase class.
How can I filter this enormous output?
Thanks in advance.
You can specify a package to cover with nosetest using –cover-package, for example:
only the modules I’ve written in the herokuapp directory are reported.