File tree 1 file changed +9
-7
lines changed 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -19,13 +19,15 @@ def __init__(self, addr):
19
19
for conn in connections .all ():
20
20
# If using in-memory sqlite databases, pass the connections to
21
21
# the server thread.
22
- if (
23
- conn .settings_dict ["ENGINE" ] == "django.db.backends.sqlite3"
24
- and conn .settings_dict ["NAME" ] == ":memory:"
25
- ):
26
- # Explicitly enable thread-shareability for this connection
27
- conn .allow_thread_sharing = True
28
- connections_override [conn .alias ] = conn
22
+ if conn .settings_dict ["ENGINE" ] == "django.db.backends.sqlite3" :
23
+ test_dbname = conn .settings_dict ['TEST' ]['NAME' ] or ':memory:'
24
+ if test_dbname == ":memory:" :
25
+ # Explicitly enable thread-shareability for this connection
26
+ if django .VERSION >= (2 , 2 ):
27
+ conn .inc_thread_sharing ()
28
+ else :
29
+ conn .allow_thread_sharing = True
30
+ connections_override [conn .alias ] = conn
29
31
30
32
liveserver_kwargs = {"connections_override" : connections_override }
31
33
from django .conf import settings
You can’t perform that action at this time.
0 commit comments