From eb9eaa6d7182e8156699a692916af4b167cdc363 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Wed, 14 Mar 2012 10:58:23 +0000 Subject: [PATCH] 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 --- tests/regressiontests/test_runner/tests.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/regressiontests/test_runner/tests.py b/tests/regressiontests/test_runner/tests.py index 12a28f9fcb..22e9fe6af5 100644 --- a/tests/regressiontests/test_runner/tests.py +++ b/tests/regressiontests/test_runner/tests.py @@ -9,6 +9,7 @@ import warnings from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command +from django import db from django.test import simple from django.test.simple import DjangoTestSuiteRunner, get_tests from django.test.testcases import connections_support_transactions @@ -218,7 +219,6 @@ class CustomTestRunnerOptionsTests(AdminScriptTestCase): class Ticket16885RegressionTests(unittest.TestCase): def test_ticket_16885(self): """Features are also confirmed on mirrored databases.""" - from django import db old_db_connections = db.connections try: db.connections = db.ConnectionHandler({ @@ -266,9 +266,11 @@ class ModulesTestsPackages(unittest.TestCase): class Sqlite3InMemoryTestDbs(unittest.TestCase): + + @unittest.skipUnless(all(db.connections[conn].vendor == 'sqlite' for conn in db.connections), + "This is a sqlite-specific issue") def test_transaction_support(self): """Ticket #16329: sqlite3 in-memory test databases""" - from django import db old_db_connections = db.connections for option in ('NAME', 'TEST_NAME'): try: @@ -283,18 +285,12 @@ class Sqlite3InMemoryTestDbs(unittest.TestCase): }, }) other = db.connections['other'] - self.assertEqual(other.features.supports_transactions, None) + self.assertIsNone(other.features.supports_transactions) DjangoTestSuiteRunner(verbosity=0).setup_databases() + msg = "DATABASES setting '%s' option set to sqlite3's ':memory:' value shouldn't interfere with transaction support detection." % option # Transaction support should be properly initialised for the 'other' DB - self.assertNotEqual( - other.features.supports_transactions, - None, - "DATABASES setting '%s' option set to sqlite3's ':memory:' value causes problems with transaction support detection." % option - ) + self.assertIsNotNone(other.features.supports_transactions, msg) # And all the DBs should report that they support transactions - self.assertTrue( - connections_support_transactions(), - "DATABASES setting '%s' option set to sqlite3's ':memory:' value causes problems with transaction support detection." % option - ) + self.assertTrue(connections_support_transactions(), msg) finally: db.connections = old_db_connections