mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Changed database connection duplication technique.
This new technique is more straightforward and compatible with test parallelization, where the effective database connection settings no longer match settings.DATABASES.
This commit is contained in:
parent
e8b49d4cc4
commit
05cea7fdbb
4 changed files with 27 additions and 27 deletions
|
@ -5,9 +5,7 @@ import time
|
|||
|
||||
from multiple_database.routers import TestRouter
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import connection, router, transaction
|
||||
from django.db.utils import DEFAULT_DB_ALIAS, ConnectionHandler, DatabaseError
|
||||
from django.db import DatabaseError, connection, router, transaction
|
||||
from django.test import (
|
||||
TransactionTestCase, override_settings, skipIfDBFeature,
|
||||
skipUnlessDBFeature,
|
||||
|
@ -30,8 +28,7 @@ class SelectForUpdateTests(TransactionTestCase):
|
|||
|
||||
# We need another database connection in transaction to test that one
|
||||
# connection issuing a SELECT ... FOR UPDATE will block.
|
||||
new_connections = ConnectionHandler(settings.DATABASES)
|
||||
self.new_connection = new_connections[DEFAULT_DB_ALIAS]
|
||||
self.new_connection = connection.copy()
|
||||
|
||||
def tearDown(self):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue