#NEWLINE# def test_max_connections_blocks( self ) : #NEWLINE# #INDENT# '\n        Getting a connection should block for until available.\n        ' #NEWLINE# q = Queue ( ) #NEWLINE# q . put_nowait ( 'Not yet got' ) #NEWLINE# pool = self . get_pool ( max_connections = 2 , timeout = 5 ) #NEWLINE# c1 = pool . get_connection ( '_' ) #NEWLINE# pool . get_connection ( '_' ) #NEWLINE# target = ( lambda : q . put_nowait ( pool . get_connection ( '_' ) ) ) #NEWLINE# Thread ( target = target ) . start ( ) #NEWLINE# time . sleep ( 0.05 ) #NEWLINE# c3 = q . get_nowait ( ) #NEWLINE# assert_equals ( c3 , 'Not yet got' ) #NEWLINE# pool . release ( c1 ) #NEWLINE# time . sleep ( 0.05 ) #NEWLINE# c3 = q . get_nowait ( ) #NEWLINE# assert_equals ( c1 , c3 )