Skip to content

Commit

Permalink
[1.6.x] Stopped a test from executing queries at the module level.
Browse files Browse the repository at this point in the history
Currently module level queries are executed against the real database
(specified in NAME) instead of the test database; since it is to late
to fix this for 1.6, we at least ensures stable builds. Refs #21443.

Backport of 4fcc1e4 from master.
  • Loading branch information
apollo13 committed Sep 22, 2013
1 parent 56201fe commit eb32de2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/transactions_regress/tests.py
Expand Up @@ -5,7 +5,7 @@
from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError
from django.test import TransactionTestCase, skipUnlessDBFeature from django.test import TransactionTestCase, skipUnlessDBFeature
from django.test.utils import override_settings, IgnorePendingDeprecationWarningsMixin from django.test.utils import override_settings, IgnorePendingDeprecationWarningsMixin
from django.utils.unittest import skipIf, skipUnless from django.utils.unittest import skipIf, skipUnless, SkipTest


from .models import Mod, M2mA, M2mB, SubMod from .models import Mod, M2mA, M2mB, SubMod


Expand Down Expand Up @@ -366,11 +366,13 @@ def work():


@skipIf(connection.vendor == 'sqlite', @skipIf(connection.vendor == 'sqlite',
"SQLite doesn't support savepoints in managed mode") "SQLite doesn't support savepoints in managed mode")
@skipIf(connection.vendor == 'mysql' and
connection.features._mysql_storage_engine == 'MyISAM',
"MyISAM MySQL storage engine doesn't support savepoints")
@skipUnlessDBFeature('uses_savepoints') @skipUnlessDBFeature('uses_savepoints')
def test_savepoint_rollback(self): def test_savepoint_rollback(self):
# _mysql_storage_engine issues a query and as such can't be applied in
# a skipIf decorator since that would execute the query on module load.
if (connection.vendor == 'mysql' and
connection.features._mysql_storage_engine == 'MyISAM'):
raise SkipTest("MyISAM MySQL storage engine doesn't support savepoints")
@commit_manually @commit_manually
def work(): def work():
mod = Mod.objects.create(fld=1) mod = Mod.objects.create(fld=1)
Expand Down

0 comments on commit eb32de2

Please sign in to comment.