mirror of
https://github.com/django/django.git
synced 2025-02-08 08:26:13 +00:00
Previously, this test could modify global state by changing connection.settings_dict. This dict is a reference to the same dict as django.db.connections.databases['default'], which is thus also changed. The cleanup of this test would replace connection.settings_dic` with a saved copy, which would leave the dict itself modified. Additionally, create_test_db() would also modify these same dicts, as well as settings.databases['default']['NAME'] by adding a "test_" prefix, which is what can cause problems later. This patch: - makes a complete copy of the connection and work on that, to improve isolation. - calls destroy_test_db() to let that code clean up anything done by create_test_db().