Opened 10 years ago

Closed 5 years ago

#11029 closed New feature (needsinfo)

Model mocking support

Reported by: Almad Owned by: nobody
Component: Testing framework Version: 1.1-beta
Severity: Normal Keywords:
Cc: django@… Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Writing unit tests is hard mainly because of how tight are Models coupled to database. Being able to mock Models in a way that one could run tests entirely in memory (giving far better performance then even in-memory sqlite as one must not handle rollbacks and stuff) would be really helpful.

Main problem to solve are foreign keys and contenttype framework handling. Solution could probably be some kind of mocking backend that do not support any database operations except for creation (and providing ID from in-memory generator) and primary-key retrieval (from stored dictionary).

Change History (8)

comment:1 Changed 10 years ago by Almad

I know this is low priority and someday/maybe request, but I was ask to store the idea during EDC sprints.

comment:2 Changed 10 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Julien Phalip

Severity: Normal
Type: New feature

comment:4 Changed 7 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 Changed 7 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 Changed 7 years ago by John Krukoff

Cc: django@… added

comment:7 Changed 6 years ago by Aymeric Augustin

Triage Stage: AcceptedSomeday/Maybe

comment:8 Changed 5 years ago by Aymeric Augustin

Resolution: needsinfo
Status: newclosed

This idea has been floating around for years. I'm not convinced it's useful to keep an open ticket without a concrete proposal.

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