summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2013-09-22 22:58:46 +0200
committerFlorian Apolloner <florian@apolloner.eu>2013-09-22 23:07:54 +0200
commit1fa8c612fc764c456f4d838805ff7fd5634b1e16 (patch)
tree10c01a8f760372b39e4c7bd895ac7b5dd913f629
parent18fe77e4ed01a7761a24de7ec7b1c3a1314fc197 (diff)
[1.5.x] Stopped a test from executing queries at the module level.
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 4fcc1e4ad8d153f41132b171c231b6d5d4086c28 from master.
-rw-r--r--tests/regressiontests/transactions_regress/tests.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/regressiontests/transactions_regress/tests.py b/tests/regressiontests/transactions_regress/tests.py
index 5d1ab2c6f6..01f4a90559 100644
--- a/tests/regressiontests/transactions_regress/tests.py
+++ b/tests/regressiontests/transactions_regress/tests.py
@@ -4,7 +4,7 @@ from django.db import connection, connections, transaction, DEFAULT_DB_ALIAS, Da
from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError
from django.test import TransactionTestCase, skipUnlessDBFeature
from django.test.utils import override_settings
-from django.utils.unittest import skipIf, skipUnless
+from django.utils.unittest import skipIf, skipUnless, SkipTest
from .models import Mod, M2mA, M2mB
@@ -247,11 +247,13 @@ class SavepointTest(TransactionTestCase):
work()
- @skipIf(connection.vendor == 'mysql' and \
- connection.features._mysql_storage_engine == 'MyISAM',
- "MyISAM MySQL storage engine doesn't support savepoints")
@skipUnlessDBFeature('uses_savepoints')
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
def work():
mod = Mod.objects.create(fld=1)