Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#18057 closed Cleanup/optimization (fixed)

Docs should say that caches are not cleared after each test

Reported by: guettli Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: hv@…, albrecht.andi@…, timograham@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by jezdez)

Caches are not cleared after each test, and running "manage.py test fooapp" can insert wrong data into the cache of a live system.

The current behavior should be documented here:

https://docs.djangoproject.com/en/dev/topics/testing/

I think it is imporant to state this, since tests use a temporary database and flush the database for each test.

Related Ticket: #16401 and #11505 (Cache should be reset after each test without flushing)

Attachments (1)

18057.diff (757 bytes) - added by timo 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 3 years ago by jezdez

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

comment:2 follow-up: Changed 3 years ago by aalbrecht

Is this really just a documentation bug? I would expect that the cache is cleared between each test - just like the database too.

comment:3 Changed 3 years ago by aalbrecht

  • Cc albrecht.andi@… added

Changed 3 years ago by timo

comment:4 Changed 3 years ago by timo

  • Cc timograham@… added
  • Has patch set

comment:5 in reply to: ↑ 2 Changed 3 years ago by ptone

  • Triage Stage changed from Accepted to Ready for checkin

Replying to aalbrecht:

Is this really just a documentation bug? I would expect that the cache is cleared between each test - just like the database too.

see #11505

Until someone can champion and shepherd that ticket through to a resolution, this note in the docs seems the right thing to do. The issue looks close to a resolution, but I have not reviewed it.

comment:6 Changed 3 years ago by Tim Graham <timograham@…>

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

In 2aaa467a2ab57d5616d384a70e2b6f8217ece63e:

Fixed #18057 - Documented that caches are not cleared after each test; thanks guettli for the suggestion.

comment:7 Changed 3 years ago by Tim Graham <timograham@…>

In bd514f28e49887e8555c289546286dc27a17ddcc:

[1.4.X] Fixed #18057 - Documented that caches are not cleared after each test; thanks guettli for the suggestion.

Backport of 2aaa467a2a from master

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