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()