Simplified testing connection type

This commit is contained in:
Claude Paroz 2013-07-09 19:47:47 +02:00
parent 550b6195ed
commit b96f3043a6
1 changed files with 2 additions and 2 deletions

View File

@ -1128,7 +1128,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'].rsplit('.', 1)[-1] in ('sqlite3', 'spatialite') if (conn.vendor == 'sqlite'
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
@ -1180,7 +1180,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'].rsplit('.', 1)[-1] in ('sqlite3', 'spatialite') if (conn.vendor == 'sqlite'
and conn.settings_dict['NAME'] == ':memory:'): and conn.settings_dict['NAME'] == ':memory:'):
conn.allow_thread_sharing = False conn.allow_thread_sharing = False