Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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 4fcc1e4 from master.
  • Loading branch information...
commit 1fa8c612fc764c456f4d838805ff7fd5634b1e16 1 parent 18fe77e
Florian Apolloner authored September 22, 2013
10  tests/regressiontests/transactions_regress/tests.py
@@ -4,7 +4,7 @@
4 4
 from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError
5 5
 from django.test import TransactionTestCase, skipUnlessDBFeature
6 6
 from django.test.utils import override_settings
7  
-from django.utils.unittest import skipIf, skipUnless
  7
+from django.utils.unittest import skipIf, skipUnless, SkipTest
8 8
 
9 9
 from .models import Mod, M2mA, M2mB
10 10
 
@@ -247,11 +247,13 @@ def work():
247 247
 
248 248
         work()
249 249
 
250  
-    @skipIf(connection.vendor == 'mysql' and \
251  
-            connection.features._mysql_storage_engine == 'MyISAM',
252  
-            "MyISAM MySQL storage engine doesn't support savepoints")
253 250
     @skipUnlessDBFeature('uses_savepoints')
254 251
     def test_savepoint_rollback(self):
  252
+        # _mysql_storage_engine issues a query and as such can't be applied in
  253
+        # a skipIf decorator since that would execute the query on module load.
  254
+        if (connection.vendor == 'mysql' and
  255
+            connection.features._mysql_storage_engine == 'MyISAM'):
  256
+            raise SkipTest("MyISAM MySQL storage engine doesn't support savepoints")
255 257
         @commit_manually
256 258
         def work():
257 259
             mod = Mod.objects.create(fld=1)

0 notes on commit 1fa8c61

Please sign in to comment.
Something went wrong with that request. Please try again.