Opened 11 years ago

Closed 7 years ago

#10853 closed Bug (fixed)

Django unit test fails when using the dummy cache backend.

Reported by: Stavros Korokithakis Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When using the dummy cache backend, the test that tests the cache fails (understandably), but it's annoying to have a test fail when this is the indended behaviour. Shouldn't this check for the dummy backend and not run the test (or expect the test to fail) if so?

FAIL: Doctest: django.contrib.sessions.tests
Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/django/test/", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for django.contrib.sessions.tests
  File "/Library/Python/2.5/site-packages/django/contrib/sessions/", line 0, in tests

File "/Library/Python/2.5/site-packages/django/contrib/sessions/", line 140, in django.contrib.sessions.tests
Failed example:

Attachments (1)

10853-1.diff (1.4 KB) - added by Claude Paroz 8 years ago.
Set explicit cache for CacheSessionTests

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by Andrew Badr

Ran into this too. A solution might involve

comment:2 Changed 10 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:3 Changed 9 years ago by b14ck

Has patch: set
Patch needs improvement: set
Version: 1.0SVN

Hey guys, I took a crack at fixing this, you can see the patch / pull request here:

Obviously, my patch is suboptimal, maybe someone could take a look at it and make it more elegant?

I'd love to see this bug get squashed though, it is really annoying when running in development mode.

comment:4 Changed 9 years ago by Chris Beaven

Severity: Normal
Type: Bug

Changed 8 years ago by Claude Paroz

Attachment: 10853-1.diff added

Set explicit cache for CacheSessionTests

comment:5 Changed 8 years ago by Claude Paroz

Easy pickings: unset
Patch needs improvement: unset
UI/UX: unset

Attached patch try to explicitely set the cache to LocMem instead of skipping the test when the dummy backend is setup.

comment:6 Changed 8 years ago by anonymous

Same problem for me. It's very annoying.

comment:7 Changed 7 years ago by Ivan Virabyan

Can someone apply the patch to trunk?

comment:8 Changed 7 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In 486e67598f8d8e83890ef3c90399d660d8e9eee6:

Fixed #10853 -- Skipped some sessions tests with dummy cache backend

Note: See TracTickets for help on using tickets.
Back to Top