This might be slightly confusing at first, but actually makes perfect sense if you think about it. If you have a brand new Django project and you run the tests it fails with a number of errors.

# python manage.py test
Creating test database...
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Installing index for auth.Permission model
Installing index for auth.Message model
EE..E...EEEEEEE..................
======================================================================
ERROR: test_password_change_fails_with_invalid_old_password (django.contrib.auth.tests.views.ChangePasswordTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/django/contrib/auth/tests/views.py", line 156, in test_password_change_fails_with_invalid_old_password
    'new_password2': 'password1',
  File "/Library/Python/2.6/site-packages/django/test/client.py", line 313, in post
    response = self.request(**r)
  File "/Library/Python/2.6/site-packages/django/core/handlers/base.py", line 92, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/Library/Python/2.6/site-packages/django/contrib/auth/decorators.py", line 78, in __call__
    return self.view_func(request, *args, **kwargs)
  File "/Library/Python/2.6/site-packages/django/contrib/auth/views.py", line 160, in password_change
    }, context_instance=RequestContext(request))
  File "/Library/Python/2.6/site-packages/django/shortcuts/__init__.py", line 20, in render_to_response
    return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
  File "/Library/Python/2.6/site-packages/django/template/loader.py", line 103, in render_to_string
    t = get_template(template_name)
  File "/Library/Python/2.6/site-packages/django/template/loader.py", line 81, in get_template
    source, origin = find_template_source(template_name)
  File "/Library/Python/2.6/site-packages/django/template/loader.py", line 74, in find_template_source
    raise TemplateDoesNotExist, name
TemplateDoesNotExist: registration/password_change_form.html
...

In total 10 tests failed. At first I thought this was wrong. There must be something wrong with my Django installation. I consulted the Django documentation on testing Django apps and all I could pick up was that when you run python manage.py test it runs the tests of all your INSTALLED_APPS in the settings.py file.

After a bit of searching, I saw a ticket was created for this and was closed with a wontfix resolution. It made sense since it is test cases that was not implemented yet. Doh! Test Driven Development.

I do think it could be useful if they added this to the Django docs as a note for n00bs like me.

Peep on Gatorpeeps 

Welcome back! You should subscribe to my RSS feed here.
You should follow me on Twitter here
You should follow me on Gatorpeeps here.