Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#12979 closed (fixed)

TestCase disables savepoint_commit, savepoint_rollback

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

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 5 years ago.
Patch
django-test-savepoints.diff (2.0 KB) - added by Alex 5 years ago.
Includes the removal of a TransactionTestCase.

Download all attachments as: .zip

Change History (10)

Changed 5 years ago by forest

Patch

comment:1 Changed 5 years ago by forest

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by thejaswi_puthraya

Isn't this ticket similar to #12087 ?

comment:4 Changed 5 years ago by forest

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

Russell, does my patch look okay?

comment:5 Changed 5 years ago by forest

  • Cc forest added

comment:6 Changed 5 years ago by russellm

  • milestone set to 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.

Changed 5 years ago by Alex

Includes the removal of a TransactionTestCase.

comment:7 Changed 5 years ago by Alex

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

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

comment:8 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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