From e8b49d4cc4056716195f16963c9bb57e87952e0b Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Mon, 7 Sep 2015 22:59:13 +0200 Subject: [PATCH] Propagated database clone settings to new connections. --- django/test/runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/django/test/runner.py b/django/test/runner.py index 0d01b9b61d..2619fe4504 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -233,7 +233,11 @@ def _init_worker(counter): for alias in connections: connection = connections[alias] settings_dict = connection.creation.get_test_db_clone_settings(_worker_id) - connection.settings_dict = settings_dict + # connection.settings_dict must be updated in place for changes to be + # reflected in django.db.connections. If the following line assigned + # connection.settings_dict = settings_dict, new threads would connect + # to the default database instead of the appropriate clone. + connection.settings_dict.update(settings_dict) connection.close()