@@ -44,14 +44,14 @@ def test_connection_creation(self):
44
44
assert connection .kwargs == connection_kwargs
45
45
46
46
def test_multiple_connections (self , master_host ):
47
- connection_kwargs = {'host' : master_host }
47
+ connection_kwargs = {'host' : master_host [ 0 ], 'port' : master_host [ 1 ] }
48
48
pool = self .get_pool (connection_kwargs = connection_kwargs )
49
49
c1 = pool .get_connection ('_' )
50
50
c2 = pool .get_connection ('_' )
51
51
assert c1 != c2
52
52
53
53
def test_max_connections (self , master_host ):
54
- connection_kwargs = {'host' : master_host }
54
+ connection_kwargs = {'host' : master_host [ 0 ], 'port' : master_host [ 1 ] }
55
55
pool = self .get_pool (max_connections = 2 ,
56
56
connection_kwargs = connection_kwargs )
57
57
pool .get_connection ('_' )
@@ -60,7 +60,7 @@ def test_max_connections(self, master_host):
60
60
pool .get_connection ('_' )
61
61
62
62
def test_reuse_previously_released_connection (self , master_host ):
63
- connection_kwargs = {'host' : master_host }
63
+ connection_kwargs = {'host' : master_host [ 0 ], 'port' : master_host [ 1 ] }
64
64
pool = self .get_pool (connection_kwargs = connection_kwargs )
65
65
c1 = pool .get_connection ('_' )
66
66
pool .release (c1 )
@@ -103,22 +103,23 @@ def get_pool(self, connection_kwargs=None, max_connections=10, timeout=20):
103
103
return pool
104
104
105
105
def test_connection_creation (self , master_host ):
106
- connection_kwargs = {'foo' : 'bar' , 'biz' : 'baz' , 'host' : master_host }
106
+ connection_kwargs = {'foo' : 'bar' , 'biz' : 'baz' ,
107
+ 'host' : master_host [0 ], 'port' : master_host [1 ]}
107
108
pool = self .get_pool (connection_kwargs = connection_kwargs )
108
109
connection = pool .get_connection ('_' )
109
110
assert isinstance (connection , DummyConnection )
110
111
assert connection .kwargs == connection_kwargs
111
112
112
113
def test_multiple_connections (self , master_host ):
113
- connection_kwargs = {'host' : master_host }
114
+ connection_kwargs = {'host' : master_host [ 0 ], 'port' : master_host [ 1 ] }
114
115
pool = self .get_pool (connection_kwargs = connection_kwargs )
115
116
c1 = pool .get_connection ('_' )
116
117
c2 = pool .get_connection ('_' )
117
118
assert c1 != c2
118
119
119
120
def test_connection_pool_blocks_until_timeout (self , master_host ):
120
121
"When out of connections, block for timeout seconds, then raise"
121
- connection_kwargs = {'host' : master_host }
122
+ connection_kwargs = {'host' : master_host [ 0 ], 'port' : master_host [ 1 ] }
122
123
pool = self .get_pool (max_connections = 1 , timeout = 0.1 ,
123
124
connection_kwargs = connection_kwargs )
124
125
pool .get_connection ('_' )
@@ -134,7 +135,7 @@ def test_connection_pool_blocks_until_conn_available(self, master_host):
134
135
When out of connections, block until another connection is released
135
136
to the pool
136
137
"""
137
- connection_kwargs = {'host' : master_host }
138
+ connection_kwargs = {'host' : master_host [ 0 ], 'port' : master_host [ 1 ] }
138
139
pool = self .get_pool (max_connections = 1 , timeout = 2 ,
139
140
connection_kwargs = connection_kwargs )
140
141
c1 = pool .get_connection ('_' )
@@ -149,7 +150,7 @@ def target():
149
150
assert time .time () - start >= 0.1
150
151
151
152
def test_reuse_previously_released_connection (self , master_host ):
152
- connection_kwargs = {'host' : master_host }
153
+ connection_kwargs = {'host' : master_host [ 0 ], 'port' : master_host [ 1 ] }
153
154
pool = self .get_pool (connection_kwargs = connection_kwargs )
154
155
c1 = pool .get_connection ('_' )
155
156
pool .release (c1 )
0 commit comments