views:

362

answers:

2

As the title says, I want to apply DATABASE_OPTIONS settings when I run my tests via ./manage.py test. In django/db/backends/creation.py, it does not consider this option at all in both create_test_db() and _create_test_db().

This breaks a test with a view that uses transaction.rollback function with InnoDB. It seems that test databases are not created with InnoDB storage engine.

Is there any workaround or fix to this problem?

A: 

One workaround might be to set the default storage engine on your server to InnoDB.

in my.cnf:

set default_storage_engine=InnoDB

That should work unless django is explicitly picking MyISAM.

Seth
Yes, I'd already applied this, but for testcases, it did not help. See my self-answer below. :)
Achimnol
A: 

I've found the reason by myself. I have to use TransactionTestCase instead of normal TestCase base class. See the documentation.

Achimnol