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:
Mariusz Felisiak 2022-10-26 08:16:57 +02:00
parent 02940ebce1
commit 80777d30b3
1 changed files with 1 additions and 0 deletions

View File

@ -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):