Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
  • Loading branch information...
commit eb9eaa6d7182e8156699a692916af4b167cdc363 1 parent 9d1d1f0
@ramiro ramiro authored
Showing with 8 additions and 12 deletions.
  1. +8 −12 tests/regressiontests/test_runner/tests.py
View
20 tests/regressiontests/test_runner/tests.py
@@ -9,6 +9,7 @@
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 @@ def test_all_options_given(self):
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 @@ def test_import_error(self):
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 @@ def test_transaction_support(self):
},
})
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
Please sign in to comment.
Something went wrong with that request. Please try again.