diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py
index ce1da6d..9ab7228 100644
a
|
b
|
class BaseDatabaseCreation(object):
|
320 | 320 | if verbosity >= 2: |
321 | 321 | test_db_repr = " ('%s')" % test_database_name |
322 | 322 | print "Destroying test database for alias '%s'%s..." % (self.connection.alias, test_db_repr) |
| 323 | # Use a thread-local copy of the settings dict. That way we avoid |
| 324 | # modifying the original settings dict which would be shared between |
| 325 | # any potential child threads. This prevents the production database |
| 326 | # from being exposed to those potential child threads while the test |
| 327 | # database is being destroyed. Refs #10868. |
| 328 | self.connection.settings_dict = self.connection.settings_dict.copy() |
323 | 329 | self.connection.settings_dict['NAME'] = old_database_name |
324 | | |
325 | 330 | self._destroy_test_db(test_database_name, verbosity) |
326 | 331 | |
327 | 332 | def _destroy_test_db(self, test_database_name, verbosity): |
diff --git a/django/test/simple.py b/django/test/simple.py
index 1534011..47bc7e0 100644
a
|
b
|
class DjangoTestSuiteRunner(object):
|
312 | 312 | return unittest.TextTestRunner(verbosity=self.verbosity, failfast=self.failfast).run(suite) |
313 | 313 | |
314 | 314 | def teardown_databases(self, old_config, **kwargs): |
| 315 | """ |
| 316 | Clean up database connections and destroy test databases. |
| 317 | |
| 318 | Note that we use thread-local copies of the connections' settings |
| 319 | dict references. That way we avoid modifying the original settings dict |
| 320 | references which would be shared between any potential child threads. |
| 321 | This prevents the production databases from being exposed to those |
| 322 | potential child threads while the test databases are being teared down. |
| 323 | Refs #10868. |
| 324 | """ |
315 | 325 | from django.db import connections |
316 | 326 | old_names, mirrors = old_config |
317 | 327 | # Point all the mirrors back to the originals |
318 | 328 | for alias, old_name in mirrors: |
| 329 | connections[alias].settings_dict = connections[alias].settings_dict.copy() |
319 | 330 | connections[alias].settings_dict['NAME'] = old_name |
320 | 331 | # Destroy all the non-mirror databases |
321 | 332 | for connection, old_name, destroy in old_names: |
322 | 333 | if destroy: |
323 | 334 | connection.creation.destroy_test_db(old_name, self.verbosity) |
324 | 335 | else: |
| 336 | connection.settings_dict = connection.settings_dict.copy() |
325 | 337 | connection.settings_dict['NAME'] = old_name |
326 | 338 | |
327 | 339 | def teardown_test_environment(self, **kwargs): |