From 05cea7fdbbcd7bdcdc8d8162d95b1dd5d8195913 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Mon, 7 Sep 2015 22:10:31 +0200 Subject: 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. --- tests/select_for_update/tests.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'tests/select_for_update') diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py index af408f8ffe..70cd21d594 100644 --- a/tests/select_for_update/tests.py +++ b/tests/select_for_update/tests.py @@ -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: -- cgit v1.3