Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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.
  • Loading branch information...
commit 4fcc1e4ad8d153f41132b171c231b6d5d4086c28 1 parent e6c0020
Florian Apolloner authored September 22, 2013

Showing 1 changed file with 6 additions and 4 deletions. Show diff stats Hide diff stats

  1. 10  tests/transactions_regress/tests.py
10  tests/transactions_regress/tests.py
... ...
@@ -1,6 +1,6 @@
1 1
 from __future__ import unicode_literals
2 2
 
3  
-from unittest import skipIf, skipUnless
  3
+from unittest import skipIf, skipUnless, SkipTest
4 4
 
5 5
 from django.db import (connection, connections, transaction, DEFAULT_DB_ALIAS, DatabaseError,
6 6
                        IntegrityError)
@@ -367,11 +367,13 @@ def work():
367 367
 
368 368
     @skipIf(connection.vendor == 'sqlite',
369 369
             "SQLite doesn't support savepoints in managed mode")
370  
-    @skipIf(connection.vendor == 'mysql' and
371  
-            connection.features._mysql_storage_engine == 'MyISAM',
372  
-            "MyISAM MySQL storage engine doesn't support savepoints")
373 370
     @skipUnlessDBFeature('uses_savepoints')
374 371
     def test_savepoint_rollback(self):
  372
+        # _mysql_storage_engine issues a query and as such can't be applied in
  373
+        # a skipIf decorator since that would execute the query on module load.
  374
+        if (connection.vendor == 'mysql' and
  375
+            connection.features._mysql_storage_engine == 'MyISAM'):
  376
+            raise SkipTest("MyISAM MySQL storage engine doesn't support savepoints")
375 377
         @commit_manually
376 378
         def work():
377 379
             mod = Mod.objects.create(fld=1)

0 notes on commit 4fcc1e4

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