mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #19296 -- Applied test connection sharing for spatialite
Thanks pegler at gmail.com for the report and the initial patch.
This commit is contained in:
		| @@ -1077,7 +1077,7 @@ class LiveServerTestCase(TransactionTestCase): | |||||||
|         for conn in connections.all(): |         for conn in connections.all(): | ||||||
|             # If using in-memory sqlite databases, pass the connections to |             # If using in-memory sqlite databases, pass the connections to | ||||||
|             # the server thread. |             # the server thread. | ||||||
|             if (conn.settings_dict['ENGINE'] == 'django.db.backends.sqlite3' |             if (conn.settings_dict['ENGINE'].rsplit('.', 1)[-1] in ('sqlite3', 'spatialite') | ||||||
|                 and conn.settings_dict['NAME'] == ':memory:'): |                 and conn.settings_dict['NAME'] == ':memory:'): | ||||||
|                 # Explicitly enable thread-shareability for this connection |                 # Explicitly enable thread-shareability for this connection | ||||||
|                 conn.allow_thread_sharing = True |                 conn.allow_thread_sharing = True | ||||||
| @@ -1129,7 +1129,7 @@ class LiveServerTestCase(TransactionTestCase): | |||||||
|  |  | ||||||
|         # Restore sqlite connections' non-sharability |         # Restore sqlite connections' non-sharability | ||||||
|         for conn in connections.all(): |         for conn in connections.all(): | ||||||
|             if (conn.settings_dict['ENGINE'] == 'django.db.backends.sqlite3' |             if (conn.settings_dict['ENGINE'].rsplit('.', 1)[-1] in ('sqlite3', 'spatialite') | ||||||
|                 and conn.settings_dict['NAME'] == ':memory:'): |                 and conn.settings_dict['NAME'] == ':memory:'): | ||||||
|                 conn.allow_thread_sharing = False |                 conn.allow_thread_sharing = False | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user