summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2012-03-14 10:58:23 +0000
committerRamiro Morales <cramm0@gmail.com>2012-03-14 10:58:23 +0000
commiteb9eaa6d7182e8156699a692916af4b167cdc363 (patch)
tree145665910874e428e525699d4a945aa8d794df3b /tests
parent9d1d1f06db07900927f26ba1595d26a6f16cfbcc (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/test_runner/tests.py20
1 files 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