diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2015-09-07 22:10:31 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2015-09-09 23:03:51 +0200 |
| commit | 05cea7fdbbcd7bdcdc8d8162d95b1dd5d8195913 (patch) | |
| tree | debff1c4693e9a18ea3472f41603da207a449101 /tests/select_for_update | |
| parent | e8b49d4cc4056716195f16963c9bb57e87952e0b (diff) | |
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.
Diffstat (limited to 'tests/select_for_update')
| -rw-r--r-- | tests/select_for_update/tests.py | 7 |
1 files changed, 2 insertions, 5 deletions
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: |
