Opened 7 years ago

Closed 3 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 7 years ago by Almad

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

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

comment:2 Changed 7 years ago by Alex

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:4 Changed 5 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:5 Changed 5 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:6 Changed 4 years ago by Helot

  • Cc django@… added

comment:7 Changed 3 years ago by aaugustin

  • Triage Stage changed from Accepted to Someday/Maybe

comment:8 Changed 3 years ago by aaugustin

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

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