Tuesday, September 4, 2012

Re: No ROLLBACK within TestCase on second database

On 05/09/12 16:28, Mike Dewhirst wrote:
I asked about this a couple of weeks ago and the correct solution is to use a TransactionTestCase

Hi Mike,

I don't want to be explicitly test transactional behaviour, which I think is the intention behind TransactionTestCase. I just want each test running a transaction which rolls back on teardown. The django documentation for TestCase seems to suggest that TestCase should provide the behaviour I'm wanting:

class TestCase
Wraps each test in a transaction.

https://docs.djangoproject.com/en/dev/topics/testing/#testcase

Explicitly calling connection._rollback() in a TransactionTestCase unfortunately has the same behaviour and only calls ROLLBACK on the 'default' database.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate