Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Tweaked tests from r17702 to run only when using sqlite3 DB(s).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit eb9eaa6d7182e8156699a692916af4b167cdc363 1 parent 9d1d1f0
Ramiro Morales authored March 14, 2012
20  tests/regressiontests/test_runner/tests.py
@@ -9,6 +9,7 @@
9 9
 
10 10
 from django.core.exceptions import ImproperlyConfigured
11 11
 from django.core.management import call_command
  12
+from django import db
12 13
 from django.test import simple
13 14
 from django.test.simple import DjangoTestSuiteRunner, get_tests
14 15
 from django.test.testcases import connections_support_transactions
@@ -218,7 +219,6 @@ def test_all_options_given(self):
218 219
 class Ticket16885RegressionTests(unittest.TestCase):
219 220
     def test_ticket_16885(self):
220 221
         """Features are also confirmed on mirrored databases."""
221  
-        from django import db
222 222
         old_db_connections = db.connections
223 223
         try:
224 224
             db.connections = db.ConnectionHandler({
@@ -266,9 +266,11 @@ def test_import_error(self):
266 266
 
267 267
 
268 268
 class Sqlite3InMemoryTestDbs(unittest.TestCase):
  269
+
  270
+    @unittest.skipUnless(all(db.connections[conn].vendor == 'sqlite' for conn in db.connections),
  271
+                         "This is a sqlite-specific issue")
269 272
     def test_transaction_support(self):
270 273
         """Ticket #16329: sqlite3 in-memory test databases"""
271  
-        from django import db
272 274
         old_db_connections = db.connections
273 275
         for option in ('NAME', 'TEST_NAME'):
274 276
             try:
@@ -283,18 +285,12 @@ def test_transaction_support(self):
283 285
                     },
284 286
                 })
285 287
                 other = db.connections['other']
286  
-                self.assertEqual(other.features.supports_transactions, None)
  288
+                self.assertIsNone(other.features.supports_transactions)
287 289
                 DjangoTestSuiteRunner(verbosity=0).setup_databases()
  290
+                msg = "DATABASES setting '%s' option set to sqlite3's ':memory:' value shouldn't interfere with transaction support detection." % option
288 291
                 # Transaction support should be properly initialised for the 'other' DB
289  
-                self.assertNotEqual(
290  
-                    other.features.supports_transactions,
291  
-                    None,
292  
-                    "DATABASES setting '%s' option set to sqlite3's ':memory:' value causes problems with transaction support detection." % option
293  
-                )
  292
+                self.assertIsNotNone(other.features.supports_transactions, msg)
294 293
                 # And all the DBs should report that they support transactions
295  
-                self.assertTrue(
296  
-                    connections_support_transactions(),
297  
-                    "DATABASES setting '%s' option set to sqlite3's ':memory:' value causes problems with transaction support detection." % option
298  
-                )
  294
+                self.assertTrue(connections_support_transactions(), msg)
299 295
             finally:
300 296
                 db.connections = old_db_connections

0 notes on commit eb9eaa6

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