Question

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?

Was it helpful?

Solution 2

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top