I work off of the Django trunk and notice that the unit tests for the Django modules in the trunk always have failures. Is the Django trunk supposed to pass all of its own unit tests?
Here are some of the example errors:
====================================================================== ERROR: test_password_change_fails_with_invalid_old_password (django.contrib.auth.tests.views.ChangePasswordTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/michael/django/trunk/django/contrib/auth/tests/views.py", line 156, in test_password_change_fails_with_invalid_old_password 'new_password2': 'password1', File "/Users/michael/django/trunk/django/test/client.py", line 318, in post response = self.request(**r) File "/Users/michael/django/trunk/django/core/handlers/base.py", line 87, in get_response response = middleware_method(request, callback, callback_args, callback_kwargs) File "/Users/michael/Documents/workspace/drchrono/drchrono_middleware/drchrono.py", line 31, in process_view setattr(request, 'currentDoctor', request.user.get_profile().doctor) #Default is to have currentDoctor be default for logged in user. File "/Users/michael/django/trunk/django/contrib/auth/models.py", line 285, in get_profile self._profile_cache = model._default_manager.get(user__id__exact=self.id) File "/Users/michael/django/trunk/django/db/models/manager.py", line 119, in get return self.get_query_set().get(*args, **kwargs) File "/Users/michael/django/trunk/django/db/models/query.py", line 298, in get % self.model._meta.object_name) DoesNotExist: UserProfile matching query does not exist.
I just realized that a lot of the errors mention a missing UserProfile and that I have a custom UserProfile object that I create when creating a new User through the Web signup process (but that does not get created when instantiating a new User object in the admin or I'll assume through the code.) So maybe this is my app's fault for not creating UserProfiles for users not created through the GUI. How can I create a UserProfile for each User object created? Do you monkeypatch the new() method of the User class?