#15026: Test failures in django.contrib.sessions on default project when 
memcached
used as CACHE_BACKEND
-------------------------------------+--------------------------------------
 Reporter:  jsdalton                 |       Owner:  nobody    
   Status:  new                      |   Milestone:  1.3       
Component:  django.contrib.sessions  |     Version:  SVN       
 Keywords:                           |       Stage:  Unreviewed
Has_patch:  0                        |  
-------------------------------------+--------------------------------------
 When running the `test` management command on a basic, default project,
 with django.contrib.sessions as the only app in INSTALLED_APPS, and
 memcached as the CACHE_BACKEND I'm getting the following test failures:

 {{{
 FAIL: test_invalid_key (django.contrib.sessions.tests.CacheDBSessionTests)
 FAIL: test_invalid_key (django.contrib.sessions.tests.CacheSessionTests)
 }}}

 The tests run fine (no failures) the first time they are run after
 memcached is restarted. The next time the tests are run, however, the
 failures occur.

 Here's a more detailed rundown:

 {{{
 # settings.py

 ...

 INSTALLED_APPS = (
     #'django.contrib.contenttypes',
     #'django.contrib.auth',
     'django.contrib.sessions',
     #'django.contrib.sites',
     #'django.contrib.messages',
     #'django.contrib.staticfiles',
     # Uncomment the next line to enable the admin:
     # 'django.contrib.admin',
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
 )

 ...

 CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
 }}}

 {{{
 # first,  make sure to restart memcached
 $ ./manage.py test
 Creating test database for alias 'default'...
 
.....................................................................................................
 ----------------------------------------------------------------------
 Ran 101 tests in 0.188s

 OK
 Destroying test database for alias 'default'...

 # now run the tests another time
 $ ./manage.py test
 Creating test database for alias 'default'...
 
.............F.................................................F.....................................
 ======================================================================
 FAIL: test_invalid_key (django.contrib.sessions.tests.CacheDBSessionTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 "/Users/jsdalton/webs/testproject/src/django/django/contrib/sessions/tests.py",
 line 165, in test_invalid_key
     self.assertNotEqual(session.session_key, '1')
 AssertionError: '1' == '1'

 ======================================================================
 FAIL: test_invalid_key (django.contrib.sessions.tests.CacheSessionTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 "/Users/jsdalton/webs/testproject/src/django/django/contrib/sessions/tests.py",
 line 165, in test_invalid_key
     self.assertNotEqual(session.session_key, '1')
 AssertionError: '1' == '1'

 ----------------------------------------------------------------------
 Ran 101 tests in 0.159s

 FAILED (failures=2)
 Destroying test database for alias 'default'...
 }}}

 I have not yet investigated the possible causes for this bug, though it
 appears as though the cache is perhaps not being flushed appropriately
 during some portion of the testing and thus values are hanging around in
 the cache when the test is run next. If I have a chance later, I'll take a
 closer look.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15026>
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to