django.test.TestCase and settings.DATABASE_SUPPORTS_TRANSACTIONS

19 views
Skip to first unread message

Duc Nguyen

unread,
Mar 25, 2009, 5:26:02 PM3/25/09
to django-d...@googlegroups.com
In django.test.TestCase, there is a check for settings.DATABASE_SUPPORTS_TRANSACTIONS but no check to make sure this setting even exists.  This causes nosetests to bail out with an AttributeError.  What is the correct way to fix this?  How do we check that our db type actually supports transactions?

-- Duc

Karen Tracey

unread,
Mar 25, 2009, 7:22:08 PM3/25/09
to django-d...@googlegroups.com
On Wed, Mar 25, 2009 at 5:26 PM, Duc Nguyen <d...@nuggien.com> wrote:
In django.test.TestCase, there is a check for settings.DATABASE_SUPPORTS_TRANSACTIONS but no check to make sure this setting even exists.  This causes nosetests to bail out with an AttributeError.  What is the correct way to fix this?  How do we check that our db type actually supports transactions?

It's set during test database creation by create_test_db in django/db/backends/creation.py.  I'm not familiar with nosetests but I guess it does not use this routine?  The implementation in creation.py tests to see whether a call to rollback actually has the effect of rolling back an uncommitted insert.  It's not pretty but I didn't know how else to test it, since rollback on MySQL/MyISAM for instance, doesn't raise an error but just doesn't have any effect.

Karen
Reply all
Reply to author
Forward
0 new messages