1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #29062 -- Prevented possibility of database lock when using LiveServerTestCase with in-memory SQLite database.

Thanks Chris Jerdonek for the implementation idea.
This commit is contained in:
baldychristophe
2022-11-18 18:26:59 +01:00
committed by Mariusz Felisiak
parent 1297c0d0d7
commit 855f5a36e7
3 changed files with 42 additions and 4 deletions

View File

@@ -111,6 +111,16 @@ class DatabaseFeatures(BaseDatabaseFeatures):
},
}
)
else:
skips.update(
{
"Only connections to in-memory SQLite databases are passed to the "
"server thread.": {
"servers.tests.LiveServerInMemoryDatabaseLockTest."
"test_in_memory_database_lock",
},
}
)
return skips
@cached_property

View File

@@ -1778,7 +1778,9 @@ class LiveServerThread(threading.Thread):
try:
# Create the handler for serving static and media files
handler = self.static_handler(_MediaFilesHandler(WSGIHandler()))
self.httpd = self._create_server()
self.httpd = self._create_server(
connections_override=self.connections_override,
)
# If binding to port zero, assign the port allocated by the OS.
if self.port == 0:
self.port = self.httpd.server_address[1]