Opened 15 years ago

Closed 11 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: dev
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

Description

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/_doctest.py", 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/tests.py", line 0, in tests

----------------------------------------------------------------------
File "/Library/Python/2.5/site-packages/django/contrib/sessions/tests.py", line 140, in django.contrib.sessions.tests
Failed example:
    cache_session.exists(cache_session.session_key)
Expected:
    True
Got:
    False

Attachments (1)

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

Download all attachments as: .zip

Change History (9)

comment:1 by Andrew Badr, 15 years ago

Ran into this too. A solution might involve http://code.djangoproject.com/ticket/4788.

comment:2 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:3 by b14ck, 13 years ago

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: https://github.com/django/django/pull/5

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 by Chris Beaven, 13 years ago

Severity: Normal
Type: Bug

by Claude Paroz, 12 years ago

Attachment: 10853-1.diff added

Set explicit cache for CacheSessionTests

comment:5 by Claude Paroz, 12 years ago

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 by anonymous, 12 years ago

Same problem for me. It's very annoying.

comment:7 by Ivan Virabyan, 11 years ago

Can someone apply the patch to trunk?

comment:8 by Claude Paroz <claude@…>, 11 years ago

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