Opened 15 years ago

Closed 14 years ago

Last modified 13 years ago

#12979 closed (fixed)

TestCase disables savepoint_commit, savepoint_rollback

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

Description

TestCase uses transactions to speed up tests. This is reasonable, well-documented behavior.

However, there is no benefit in disabling savepoint_commit and savepoint_rollback. With these functions disabled, there is no way to recover the transaction if an IntegrityError occurs.

Fixing this is trivial (I'll attach a patch).

Attachments (2)

django-testcase-support-savepoints.patch (1.3 KB ) - added by Forest Bond 15 years ago.
Patch
django-test-savepoints.diff (2.0 KB ) - added by Alex Gaynor 14 years ago.
Includes the removal of a TransactionTestCase.

Download all attachments as: .zip

Change History (10)

by Forest Bond, 15 years ago

Patch

comment:1 by Forest Bond, 15 years ago

Has patch: set

comment:2 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Thejaswi Puthraya, 15 years ago

Isn't this ticket similar to #12087 ?

comment:4 by Forest Bond, 15 years ago

No, #12087 deals with TransactionTestCase whereas this ticket is specific to TestCase.

Russell, does my patch look okay?

comment:5 by Forest Bond, 15 years ago

Cc: Forest Bond added

comment:6 by Russell Keith-Magee, 15 years ago

milestone: 1.3

Prima facie, yes, it looks fine (as in, it does what it says it should). I need to have a bit more of a think about the consequences of this change, but on first inspection, it seems reasonable.

by Alex Gaynor, 14 years ago

Attachment: django-test-savepoints.diff added

Includes the removal of a TransactionTestCase.

comment:7 by Alex Gaynor, 14 years ago

Resolution: fixed
Status: newclosed

(In [14061]) Fixed #12979 -- allowed using savepoints in TestCase (i.e. tests with transactions disabled), convert the GetOrCreate tests to use this.

comment:8 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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