#15142: Contrib tests throwing errors on bare project when cache middleware enabled and cache specified --------------------------+------------------------------------------------- Reporter: jsdalton | Owner: nobody Status: new | Milestone: Component: Contrib apps | Version: SVN Keywords: | Stage: Unreviewed Has_patch: 0 | --------------------------+------------------------------------------------- I ran into an issue recently where the contrib tests were throwing multiple errors during a test run when cache middleware was enabled and a cache was specified.
This is exactly the behavior described in this Stack Overflow question: http://stackoverflow.com/questions/3219668/using-django-cache-middleware- causes-contrib-auth-unit-tests-to-fail Here is a description of the setup and the steps to reproduce the problem (taken from that question): My Middleware: {{{ MIDDLEWARE_CLASSES = ( 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', ) }}} All my test failures look like the one below: {{{ ====================================================================== Error: test_last_login (django.contrib.auth.tests.remote_user.RemoteUserTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Python26\lib\site- packages\django\contrib\auth\tests\remote_user.py", line 87, in test_last_login self.assertNotEqual(default_login, response.context['user'].last_login) TypeError: 'NoneType' object is unsubscriptable }}} Steps to Reproduce: 1. Start a new django project (django-admin.py startproject myproject) and configure settings.py 2. Add CACHE_BACKEND to settings.py and add the two Cache Middlewares from Django 3. Run python manage.py test I have an idea as to the cause and a proposed patch to resolve this, but I will add it with a separate comment to keep the description of the issue clean here. -- Ticket URL: <http://code.djangoproject.com/ticket/15142> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.