Opened 7 years ago

Closed 4 years ago

#10853 closed Bug (fixed)

Django unit test fails when using the dummy cache backend.

Reported by: stavros 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 claudep 5 years ago.
Set explicit cache for CacheSessionTests

Download all attachments as: .zip

Change History (9)

comment:1 Changed 7 years ago by andrewbadr

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Ran into this too. A solution might involve

comment:2 Changed 7 years ago by Alex

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 6 years ago by b14ck

  • Has patch set
  • Patch needs improvement set
  • Version changed from 1.0 to SVN

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 5 years ago by SmileyChris

  • Severity set to Normal
  • Type set to Bug

Changed 5 years ago by claudep

Set explicit cache for CacheSessionTests

comment:5 Changed 5 years ago by claudep

  • 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 4 years ago by anonymous

Same problem for me. It's very annoying.

comment:7 Changed 4 years ago by ivan_virabyan

Can someone apply the patch to trunk?

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

  • Resolution set to fixed
  • Status changed from new to closed

In 486e67598f8d8e83890ef3c90399d660d8e9eee6:

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

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