mirror of https://github.com/django/django.git
Refs #33173 -- Fixed destroying test databases when running tests in parallel using spawn on Windows.
Thanks Simon Willison for inspiration.
This commit is contained in:
parent
02940ebce1
commit
80777d30b3
|
@ -104,6 +104,7 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
elif multiprocessing.get_start_method() == "spawn":
|
elif multiprocessing.get_start_method() == "spawn":
|
||||||
ondisk_db = sqlite3.connect(target_database_name, uri=True)
|
ondisk_db = sqlite3.connect(target_database_name, uri=True)
|
||||||
self.connection.connection.backup(ondisk_db)
|
self.connection.connection.backup(ondisk_db)
|
||||||
|
ondisk_db.close()
|
||||||
|
|
||||||
def _destroy_test_db(self, test_database_name, verbosity):
|
def _destroy_test_db(self, test_database_name, verbosity):
|
||||||
if test_database_name and not self.is_in_memory_db(test_database_name):
|
if test_database_name and not self.is_in_memory_db(test_database_name):
|
||||||
|
|
Loading…
Reference in New Issue