File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ def django_db_setup(django_db_setup, django_db_blocker):
3535 with django_db_blocker .unblock ():
3636 qn = connection .ops .quote_name
3737
38+ db_user = settings .DATABASES [connection .alias ]["USER" ]
3839 db_hostname = settings .DATABASES [connection .alias ]["HOST" ]
3940
4041 with tempfile .TemporaryDirectory () as temp_dir :
@@ -45,9 +46,13 @@ def django_db_setup(django_db_setup, django_db_blocker):
4546 #
4647 # Note that this only typically works in CI environments
4748 # where we have utter control to execute arbitary commands.
48- if db_hostname and db_hostname not in (
49- "127.0.0.1" ,
50- "localhost" ,
49+ if db_user or (
50+ db_hostname
51+ and db_hostname
52+ not in (
53+ "127.0.0.1" ,
54+ "localhost" ,
55+ )
5156 ):
5257 cursor .execute (
5358 f"COPY (select 1) TO PROGRAM 'mkdir --mode=777 -p { temp_dir } '"
You can’t perform that action at this time.
0 commit comments