Commit eb9eaa6d authored by Ramiro Morales's avatar Ramiro Morales
Browse files

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
parent 9d1d1f06
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -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