@@ -79,8 +79,6 @@ def test_parse_host(self):
79
79
'tcp://:7777' : 'http://127.0.0.1:7777' ,
80
80
'http://:7777' : 'http://127.0.0.1:7777' ,
81
81
'https://kokia.jp:2375' : 'https://kokia.jp:2375' ,
82
- '' : 'http+unix://var/run/docker.sock' ,
83
- None : 'http+unix://var/run/docker.sock' ,
84
82
'unix:///var/run/docker.sock' : 'http+unix:///var/run/docker.sock' ,
85
83
'unix://' : 'http+unix://var/run/docker.sock' ,
86
84
'somehost.net:80/service/swarm' : (
@@ -90,10 +88,20 @@ def test_parse_host(self):
90
88
91
89
for host in invalid_hosts :
92
90
with pytest .raises (DockerException ):
93
- parse_host (host )
91
+ parse_host (host , None )
94
92
95
93
for host , expected in valid_hosts .items ():
96
- self .assertEqual (parse_host (host ), expected , msg = host )
94
+ self .assertEqual (parse_host (host , None ), expected , msg = host )
95
+
96
+ def test_parse_host_empty_value (self ):
97
+ unix_socket = 'http+unix://var/run/docker.sock'
98
+ tcp_port = 'http://127.0.0.1:2375'
99
+
100
+ for val in [None , '' ]:
101
+ for platform in ['darwin' , 'linux2' , None ]:
102
+ assert parse_host (val , platform ) == unix_socket
103
+
104
+ assert parse_host (val , 'win32' ) == tcp_port
97
105
98
106
def test_kwargs_from_env_empty (self ):
99
107
os .environ .update (DOCKER_HOST = '' ,
0 commit comments