Opened 8 years ago

Closed 5 years ago

#27835 closed New feature (invalid)

Make TransactionTestCase raise an error if it accesses non-default database connection without multi_db=True

Reported by: Tim Graham Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Suggested by Simon on my PR to fix some test isolation problems, TransactionTestCase and its subclasses could raise an error if they make queries on non-default databases. A rough sketch of this could be implemented is attached.

Attachments (1)

27835.diff (7.0 KB ) - added by Tim Graham 8 years ago.

Download all attachments as: .zip

Change History (2)

by Tim Graham, 8 years ago

Attachment: 27835.diff added

comment:1 by Mariusz Felisiak, 5 years ago

Resolution: invalid
Status: newclosed

multi_db was removed in Django 3.1. Moreover TransactionTestCase with a new databases attribute raises errors in such cases (see 8c775391b78b2a4a2b57c5e89ed4888f36aada4b).

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