File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ def get_connection(self):
221
221
del self ._connections_free [i ]
222
222
return conn
223
223
224
- return None
224
+ raise mariadb . PoolError ( "No connection available" )
225
225
226
226
def _close_connection (self , connection ):
227
227
"""
Original file line number Diff line number Diff line change @@ -207,18 +207,15 @@ def test_connection_pool_conf(self):
207
207
208
208
def test_connection_pool_maxconn (self ):
209
209
default_conf = conf ()
210
- pool = mariadb .ConnectionPool (pool_name = "test_max_size" ,
210
+ pool = mariadb .ConnectionPool (pool_name = "test_max_size" , pool_size = 6 ,
211
211
** default_conf )
212
212
connections = []
213
- for i in range (1 , 6 ):
213
+ for i in range (0 , 6 ):
214
214
connections .append (pool .get_connection ())
215
- try :
216
- pool .get_connection ()
217
- except mariadb .PoolError :
218
- pass
215
+ self .assertRaises (mariadb .PoolError , lambda :pool .get_connection ())
216
+
219
217
for c in connections :
220
218
c .close ()
221
- pool .get_connection ()
222
219
pool .close ()
223
220
224
221
def test_connection_pool_add (self ):
You can’t perform that action at this time.
0 commit comments