The 'silently' part does not help a user that is using `TestCase` but
should be using `TransactionTestCase`.
--
Ticket URL: <https://code.djangoproject.com/ticket/20316>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
In a perfect world, I would like to see at least one of the following
happen:
* `nop` raise an exception warning the user that they should be using
`TransactionTestCase`
* A print statement warning the user
* The docs on `TransactionTestCase` updated to not use the word
'prevents', and mention something about how functions like `commit` and
`rollback` are essentially callable nops when used in a `TestCase`.
--
Ticket URL: <https://code.djangoproject.com/ticket/20316#comment:1>
* component: Testing framework => Documentation
* version: 1.4 => master
* easy: 0 => 1
* keywords: => testcase transactions
* needs_docs: 0 => 1
* type: Uncategorized => Cleanup/optimization
Comment:
Unfortunately first and second options are no-go since there's no reliable
way to differentiate implicit from explicit `commit` and `rollback` calls.
i.e. You'd like explicit `transaction.commit` call to raise an exception
or a warning but not the implicit calls from `Model().save()`.
It would also be highly backward incompatible.
Third option seems reasonable, a documentation patch is welcome!
--
Ticket URL: <https://code.djangoproject.com/ticket/20316#comment:2>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/20316#comment:3>
Comment (by anonymous):
I've changed the docs, basically restating what the ticket author has
already said.
patch at:
https://github.com/lolek09/django/commit/2df87c45496bf7a9e2da109ffee20d50b40af042.patch
graphic diff:
https://github.com/lolek09/django/commit/2df87c45496bf7a9e2da109ffee20d50b40af042
--
Ticket URL: <https://code.djangoproject.com/ticket/20316#comment:4>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/20316#comment:5>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"dffdca1109a2111f104f2419d081c0f971537fec"]:
{{{
#!CommitTicketReference repository=""
revision="dffdca1109a2111f104f2419d081c0f971537fec"
Fixed #20316 - Clarified transaction behavior of TestCase.
Thanks uberj@ for the report and lolek09 for the patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/20316#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"cd15a51c3eb2918107814e7c42533ebef982a431"]:
{{{
#!CommitTicketReference repository=""
revision="cd15a51c3eb2918107814e7c42533ebef982a431"
[1.5.x] Fixed #20316 - Clarified transaction behavior of TestCase.
Thanks uberj@ for the report and lolek09 for the patch.
Backport of dffdca1109 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/20316#comment:7>