Skip to content
Permalink
Browse files

Fixed #16885 -- Confirmed features of mirror databases when setting u…

…p test databases.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17382 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
aaugustin committed Jan 20, 2012
1 parent 477f4d8 commit 905e33f84a1a10e4f0183d879c52076ef876fc3b
Showing with 25 additions and 1 deletion.
  1. +1 −0 django/test/simple.py
  2. +24 −1 tests/regressiontests/test_runner/tests.py
@@ -304,6 +304,7 @@ def setup_databases(self, **kwargs):
for alias, mirror_alias in mirrored_aliases.items():
mirrors.append((alias, connections[alias].settings_dict['NAME']))
connections[alias].settings_dict['NAME'] = connections[mirror_alias].settings_dict['NAME']
connections[alias].features = connections[mirror_alias].features

return old_names, mirrors

@@ -10,7 +10,7 @@
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.test import simple
from django.test.simple import get_tests
from django.test.simple import DjangoTestSuiteRunner, get_tests
from django.test.utils import get_warnings_state, restore_warnings_state
from django.utils import unittest
from django.utils.importlib import import_module
@@ -214,6 +214,29 @@ def test_all_options_given(self):
self.assertOutput(out, 'bar:foo:31337')


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({
'default': {
'ENGINE': 'django.db.backends.sqlite3',
},
'slave': {
'ENGINE': 'django.db.backends.sqlite3',
'TEST_MIRROR': 'default',
},
})
slave = db.connections['slave']
self.assertEqual(slave.features.supports_transactions, None)
DjangoTestSuiteRunner(verbosity=0).setup_databases()
self.assertNotEqual(slave.features.supports_transactions, None)
finally:
db.connections = old_db_connections


class Ticket17477RegressionTests(AdminScriptTestCase):
def setUp(self):
self.write_settings('settings.py')

0 comments on commit 905e33f

Please sign in to comment.
You can’t perform that action at this time.